Skip to content

Instantly share code, notes, and snippets.

@topolik
Created January 15, 2013 15:49
Show Gist options
  • Save topolik/4539606 to your computer and use it in GitHub Desktop.
Save topolik/4539606 to your computer and use it in GitHub Desktop.
public class SimplePortlet extends GenericPortlet {
public void render(RenderRequest request, RenderResponse response) throws PortletException, IOException {
String page = request.getParameter("page");
PortletContext portletContext = getPortletContext();
PortletRequestDispatcher portletRequestDispatcher = null;
if(page == null){
portletRequestDispatcher = portletContext.getRequestDispatcher("/WEB-INF/my-portlet-folder/view.jsp");
}
if(page.equals("page-1")){
portletRequestDispatcher = portletContext.getRequestDispatcher("/WEB-INF/my-portlet-folder/view-1.jsp");
}
if(page.equals("page-2")){
portletRequestDispatcher = portletContext.getRequestDispatcher("/WEB-INF/my-portlet-folder/view-2.jsp");
}
portletRequestDispatcher.include(request, response);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment