Reference

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 name
    • src/
      • 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 path
            • content/ → Resource bundles
            • log4j.properties → Log4J logging configuration
          • webapp/
            • resources/
              • css/ → Style sheets
              • images/ → Images
            • WEB-INF/
              • spring-context/ → Contexts
                • portlet/ → Portlet contexts
                  • portlet1-context.xml → Portlet context
                • portlet-application-context.xml → Application context
              • views/ → View templates
              • liferay-display.xml → Portlet display configuration
              • liferay-plugin-package.properties → Packaging descriptor
              • liferay-portlet.xml → Liferay-specific portlet configuration
              • portlet.xml → Portlet configuration
              • web.xml → Web application configuration
      • test/java/ → Test source files
    • build.gradle → Gradle build file