user3237100
user3237100

Reputation: 41

using liferay-portlet:renderURL tag in jspf files

I'm using liferay 6.1 CE (Liferay Portal Community Edition 6.1.1 CE GA2 (Paton / Build 6101 / July 31, 2012))

I want to set a table layout from control panel portlet icon with link on theme , for first page in control pan (that is empty by default and show please-select-a-tool-from-the-left-menu" message)

I'm working on a hook to change html/portal/layout/view/control-panel.jsp and add this code:

<% 
String description2 = StringPool.BLANK;

String className2 = "portlet-msg-info";

if (denyAccess||
    (themeDisplay.isStateExclusive() ||
        themeDisplay.isStatePopUp() || 
        (layoutTypePortlet.hasStateMax() && (portlet != null)) || 
            Validator.isNotNull(controlPanelCategory)))
{
%>

    <%@ include file="/html/portal/layout/view/panel_content.jspf" %>

<%
} else
{
    if (Validator.isNull(description2)) {
        //khane : here we should load control panel first page
        //description = LanguageUtil.get(pageContext, "please-select-a-tool-       from-the-left-menu");
    %>

        <%@ include file="/html/portlet/control_panel_menu/test.jspf" %>

    <%
    }
}
%>

This code show my page test.jspf. If that is first control-panel page instead "please-select-a-tool-from-the-left-menu" message;

But my problem is about test.jspf.

I try to create it similar to html.portlet/control-panel-menu/view.jsp, but on processing liferay-portlet:renderURL tag to create link on icons I get this error:

[ActionURL Tag:71] Render response is null because tag is not being called within the context of a portlet

and link on icons is the same page (control panel first page) instead the corresponding for each ones. this is my test.jspf code:

<%
String[] allCategories2 = PortletCategoryKeys.ALL;

String controlPanelCategory2 = HttpUtil.getParameter(PortalUtil.getCurrentURL(request), "controlPanelCategory", false);

if (Validator.isNotNull(controlPanelCategory2)) {
    allCategories2 = new String[] {controlPanelCategory2};
}

for (String curCategory : allCategories2) {
    List<Portlet> portlets = PortalUtil.getControlPanelPortlets(curCategory, themeDisplay);
%>

<ul class="category-portlets">

<%
for (Portlet portlet2 : portlets) {
    if (portlet2.isActive() && !portlet2.isInstanceable()) {
        String portletId = portlet2.getPortletId();
%>

<li class="<%= ppid.equals(portletId) ? "selected-portlet" : "" %>">
    <a href="<liferay-portlet:renderURL doAsGroupId="<%= themeDisplay.getScopeGroupId() %>" portletName="<%= portlet2.getRootPortletId() %>" windowState="<%= WindowState.MAXIMIZED.toString() %>" />" id="<portlet2:namespace />portlet_<%= portletId %>">
        <c:choose>
            <c:when test="<%= Validator.isNull(portlet2.getIcon()) %>">
                1<liferay-ui:icon src='<%= themeDisplay.getPathContext() + "/html/icons/default.png" %>' />
            </c:when>
            <c:otherwise>
                <liferay-portlet:icon-portlet portlet="<%= portlet2 %>" />
            </c:otherwise>
        </c:choose>

        <%= PortalUtil.getPortletTitle(portlet2, application, locale) %>
    </a>
</li>

<%
    }
}
%>

</ul>

<%
}
%>

Any help please??

Upvotes: 1

Views: 1363

Answers (1)

Pankaj Kathiriya
Pankaj Kathiriya

Reputation: 4210

Based on ActionURLTag.java (which is extended by RenderURLTag.java), it seems <lifeary-portlet:renderURL> should be used within context of portlet. It looks javax.portlet.request attribute in current httpServletRequest, if it does not find, error gets logged.

Here, you are using <lifeary-portlet:renderURL> in html/portal/layout/view/control-panel.jsp which is not part of any portlet so you are getting this error.

Code of ActionURLTag.java here.

Upvotes: 1

Related Questions