liferay 在jsp中直接使用的对象

    技术2025-05-27  21

     

    liferay中的内置对象有

    themeDisplay、company、account、user、realUser、contact、layout、layouts、plid、layoutTypePortlet、

    scopeGroupId、permissionChecker、locale、timeZone、theme、portletGroupId

     

    其核心就只有themeDisplay,其余都是通过themeDisplay获得的

     

     

    这些内置对象是在html/common/init.jsp中通过

    <liferay-theme:defineObjects />注入的

     

    以下是<liferay-theme:defineObjects />的实现类DefineObjectsTag的核心代码

     

    if (themeDisplay != null) {

    pageContext.setAttribute("themeDisplay", themeDisplay);

    pageContext.setAttribute("company", themeDisplay.getCompany());

    pageContext.setAttribute("account", themeDisplay.getAccount());

    pageContext.setAttribute("user", themeDisplay.getUser());

    pageContext.setAttribute("realUser", themeDisplay.getRealUser());

    pageContext.setAttribute("contact", themeDisplay.getContact());

     

    if (themeDisplay.getLayout() != null) {

    pageContext.setAttribute("layout", themeDisplay.getLayout());

    }

     

    if (themeDisplay.getLayouts() != null) {

    pageContext.setAttribute("layouts", themeDisplay.getLayouts());

    }

     

    pageContext.setAttribute("plid", new Long(themeDisplay.getPlid()));

     

    if (themeDisplay.getLayoutTypePortlet() != null) {

    pageContext.setAttribute(

    "layoutTypePortlet", themeDisplay.getLayoutTypePortlet());

    }

     

    pageContext.setAttribute(

    "scopeGroupId", new Long(themeDisplay.getScopeGroupId()));

    pageContext.setAttribute(

    "permissionChecker", themeDisplay.getPermissionChecker());

    pageContext.setAttribute("locale", themeDisplay.getLocale());

    pageContext.setAttribute("timeZone", themeDisplay.getTimeZone());

    pageContext.setAttribute("theme", themeDisplay.getTheme());

    pageContext.setAttribute(

    "colorScheme", themeDisplay.getColorScheme());

    pageContext.setAttribute(

    "portletDisplay", themeDisplay.getPortletDisplay());

     

    // Deprecated

     

    pageContext.setAttribute(

    "portletGroupId", new Long(themeDisplay.getScopeGroupId()));

    }

     

    最新回复(0)