PortletMVC4Spring Project Anatomy
PortletMVC4Spring portlets are packaged in WARs. Liferay provides project templates for creating projects configured to use JSP/JSPX and Thymeleaf templates. Their commands appear below. The PortletMVC4Spring project structure follows the commands.
Blade Commands for Generating PortletMVC4Spring Projects
Here are Blade commands for generating PortletMVC4Spring portlet projects that use JSPX and Thymeleaf View templates:
SP/JSPX Form Portlet
blade create [Project Name] -t spring-mvc-portlet --framework portletmvc4spring --view-type jsp
Thymeleaf Form Portlet
blade create [Project Name] -t spring-mvc-portlet --framework portletmvc4spring --view-type thymeleaf
Project Structure
The Blade commands generate a project that includes Model and Controller classes, View templates, a resource bundle, a stylesheet, and more. The Spring contexts and configuration files set PortletMVC4Spring development essentials. Here’s the resulting project structure:
[Project Name]/ → Arbitrary project namesrc/main/java/[my-package-path]/controller/→ Sub-package for Controller classes (optional)dto/→ Sub-package for Model (data transfer object) classes (optional)resources/→ Resources to include in the class pathcontent/→ Resource bundleslog4j.properties→ Log4J logging configuration
webapp/resources/css/→ Style sheetsimages/→ Images
WEB-INF/spring-context/→ Contextsportlet/→ Portlet contextsportlet1-context.xml→ Portlet context
portlet-application-context.xml→ Application context
views/→ View templatesliferay-display.xml→ Portlet display configurationliferay-plugin-package.properties→ Packaging descriptorliferay-portlet.xml→ Liferay-specific portlet configurationportlet.xml→ Portlet configurationweb.xml→ Web application configuration
test/java/→ Test source files
build.gradle→ Gradle build file