2/03/2014

How to show a JSP full-screen in liferay

Just answered this question to a developer on stackoverflow, so I just wanted to share it in my blog. If you want to access a JSP in full-screen mode, without showing anything of the liferay portal the JSP is deployed in, you can do the following:


Create a portlet and inside the portlet, create a servlet. This has the nice advantage that you can access your JSP by a URL like http://localhost:8080/your-portlet/your-servlet. Just think about a nice name and you will come up with a dozen business cases. Anyway ... inside your servlet you can now do a forward to your JSP and this JSp will then be displayed in full-screen. Please note that now you don´t have access to the liferay request context - no themeDisplay for example.



Creating the forward in your Servlet is pretty simple. Just add the following:

String forwardJSP = "/your-jsp.jsp";
RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher(forwardJSP);
requestDispatcher.forward(request,response);

If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.