0
votes

i have to display a JPS inside the Document and Media portlet in liferay.

I have define an action class: CmisSearchPortletAction

public class CmisSearchPortletAction extends BaseStrutsPortletAction {
    @Override
    public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
        // TODO
    }
    @Override
    public String render(StrutsPortletAction originalStrutsPortletAction,PortletConfig portletConfig,RenderRequest renderRequest, RenderResponse renderResponse) throws Exception {
        renderRequest.setAttribute("name", "World");
        return "/portlet/document_library/cmis_search.jsp";
    }
}

I add to /html/portlet/document_library/toolbar.jsp the code to execute my action:

<span id="<portlet:namespace />searchButtonContainer">
    <liferay-util:include page="/html/portlet/document_library/search_button.jsp" />
</span>

I create the page /html/portlet/document_library/search_button.jsp

<%@ include file="/html/portlet/document_library/init.jsp" %>

<liferay-ui:icon-menu align="left" direction="down" icon="" message="search" showExpanded="<%= false %>" showWhenSingleIcon="<%= true %>">

    <portlet:renderURL var="urlSearch">
        <portlet:param name="struts_action" value="/document_library/cmis_search" />
        <portlet:param name="redirect" value="<%= currentURL %>" />
    </portlet:renderURL>

    <liferay-ui:icon image="add_instance" message='<%="Busqueda Avanzada"%>' url="<%= urlSearch %>" />

</liferay-ui:icon-menu>

And finally, my JPS action (cmis_search.jsp):

<%@ include file="/html/portlet/document_library/init.jsp" %>
<%  String name = (String)request.getAttribute("name"); %>
Hello <%= name %>!

When I click the Search button my action (CmisSearchPortletAction) is executed and i can view the JSP (cmis_search.jsp) in liferay, but here is the problem.

The content is not inside the 'Document and media' portlet. How can I do this?.

I Want to move the red one to the docs and media portlet like in this img

1

1 Answers

0
votes

to display xxx.JSP inside the Document and Media portlet in liferay

Document and Media portlet's view.jsp page is in /html/portlet/document_library directory. You can extend/override it with a jsp hook.

I may use <liferay-util:include page="xxx.jsp" /> in it in an appropriate place.

Here is how you can do it.