O'Reilly logo

Liferay User Interface Development by Frank Yu, Xinsheng Chen, Jonas X. Yuan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Velocity template for e-mail

There are other uses for Velocity templates. For example, we can use a Velocity template for generating the body of an e-mail. We put the e-mail body in a template instead of hard-coding it in Java. We would also put the sender's name and the sender's e-mail address in a portlet.properties file.

  1. Run create.bat vmail Vmail in the ${PLUGINS_SDK_HOME}/portlets/ directory to create a Vmail portlet.
  2. Create a ${PLUGINS_SDK_HOME}/portlets/vmail-portlet/docroot/WEB-INF/src/com/sample/jsp/portlet/etemplate.vm template with the following content:
    Thank you for your excellent work on $company.getProjectName() for $company.getCompanyName()
    
  3. Create a ${PLUGINS_SDK_HOME}/portlets/vmail-portlet/docroot/WEB-INF/src/com/sample/jsp/portlet/JSPPortlet.java ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required