【问题标题】:How to show site page urls in Liferay jsp portlet?如何在 Liferay jsp portlet 中显示网站页面 url?
【发布时间】:2013-04-18 20:00:12
【问题描述】:

我想在 Liferay jsp portlet 中显示一些 站点页面 url。我正在使用 Liferay 6.1 EE。我想使用页面的本地化标题和添加的其他自定义字段(例如 cssClass)。

我为导航栏做了同样的事情,我的 velocity 主题

#if (!$page_group.isUser())

    #set($layoutLocalService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))

    <ul id="quickLinks">
        <li>
            #set($currFriendlyUrl = "/i-want-to")
            #set($currLayout = $layoutLocalService.getFriendlyURLLayout($group_id, true, $currFriendlyUrl))
            <a href="$currLayout.getRegularURL($request)" $currLayout.getTarget() class="$currLayout.getExpandoBridge().getAttribute('cssClass')">$currLayout.getName($locale)</a>
        </li>
    </ul>
#end

如何使用 jsp 编写相同的代码?

我找到了similar quesion,但答案中没有明确的jsp代码示例。

【问题讨论】:

    标签: jsp liferay liferay-6 liferay-velocity


    【解决方案1】:

    设法用jsp实现如下:

    <%@ page import="com.liferay.portal.service.LayoutLocalServiceUtil" %>
    <% if (!layout.getGroup().isUserGroup()) { %>
        <ul id="quickLinks">
            <li>
                <% Layout currLayout = LayoutLocalServiceUtil.getFriendlyURLLayout(scopeGroupId, true, "/i-want-to"); %>
                <a href="<%=currLayout.getRegularURL(request)%>" <%=currLayout.getTarget()%> class='<%=currLayout.getExpandoBridge().getAttribute("cssClass")%>'><%=currLayout.getName(locale)%></a>
            </li>
        </ul>
    <% } %>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-18
      • 1970-01-01
      • 2018-03-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多