How to include JSP in your Liferay theme

As agreed with Piotr Filipowicz, the easiest way to include JSP in your Liferay theme is to create a “jsp” folder in your ${plugins_sdk}/themes/${customized theme folder}/docroot/_diff directory and deposit all of your customized jsp in the jsp folder.

To include the jsp in the vm template (for example portal_normal.vm), simply call the following code:
$theme.include($themeServletContext, “/jsp/test.jsp”)

Note:
You might need to include “portal-impl.jar” under your theme directory (${theme folder}/WEB-INF/lib) if you need to call classes from the following packages:

  1. com.liferay.portal.model (Theme)
  2. com.liferay.portal.theme (ThemeDisplay)
  3. com.liferay.portal.util (WebKeys)

portal-impl.jar can be found at ${liferay folder}${tomcat folder}webappsROOTWEB-INFlib

References:
Tips & Tricks: include jsp into vm template by Piotr Filipowicz

Leave a Reply

Your email address will not be published. Required fields are marked *