Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Multiple Pages Inside One Liferay Portlet

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 885
    Comment on it

    Hello Guys

    We can add multiple Pages Inside One Liferay Portlet from portlet class.
    You can display any JSP page's you want via the PortletRequestDispatcher in your doView, doHelp, doEdit etc. method.

    Below example help you to add multiple Pages Inside One Liferay Portlet :

    protected void doView(RenderRequest req, RenderResponse resp)
           throws PortletException, IOException, UnavailableException {
       resp.setContentType("text/html"); 
       String myview = req.getParameter("myview");
       String view = "/WEB-INF/jsp/" + (myview==null ? "bar" : myview) + ".jsp";
       PortletRequestDispatcher dispatcher = 
                                     getPortletContext().getRequestDispatcher(view);
       dispatcher.include(req, resp);
    }
    

    You could use a parameter to set the view page. In the JSP with the links, you need to use the Portlet API to create/encode the links to the Portlet.

    For example:

    <portlet:renderURL>
      <portlet:param name="myview" value="foo"/>
    </portlet:renderURL>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: