1

I would like to show some site page urls in a Liferay jsp portlet. I'm using Liferay 6.1 EE. I would like to use page's localized title and other custom fields added (e.g. cssClass).

I have done the same for the navigation bar, for my velocity theme:

#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

How could I write the same code using jsp?

I have found a similar quesion, but there was not a clear code example for jsp in answers.

4

1 回答 1

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>
<% } %>
于 2013-04-18T12:00:12.287 回答