[JAVA] How to remove Tiles from TERASOLUNA 5.x blank project

1.First of all

When creating a Spring MVC application, TERASOLUNA Server Framework for Java (5.x) may be used. However, by default the template engine Tiles (https://tiles.apache.org/) is enabled. Since I rarely use Tiles, I deleted the settings and files related to Tiles every time. This time I would like to keep a personal memorandum on how to remove Tiles from the TERASOLUNA 5.x blank project.

2. Modifications

2.1 Remove Tiles dependencies from web project pom.xml

Remove (comment out) terasoluna-gfw-recommended-web-dependencies from the dependencies.

<!-- 
<dependency>
    <groupId>org.terasoluna.gfw</groupId>
    <artifactId>terasoluna-gfw-recommended-web-dependencies</artifactId>
    <type>pom</type>
</dependency>
-->

As you can see below, only Tiles related libraries are defined. https://github.com/terasolunaorg/terasoluna-gfw/blob/master/terasoluna-gfw-dependencies/terasoluna-gfw-recommended-web-dependencies/pom.xml

2.2 Delete Tiles template file

The files stored in / web project / src / main / webapp / WEB-INF / views / layout are Tiles related files. If you don't use Tiles, you don't need it, so you delete the layout directory itself.

2.3 Removal of ViewResolver that is no longer needed

There is a ViewResolver definition in /web project/src/main/resources/META-INF/spring/spring-mvc.xml. Remove the View related Tile from here. What you don't need is the definition of <mvc: tiles /> and <mvc: tiles-configurer>.

<!-- Settings View Resolver. -->
<mvc:view-resolvers>
    <mvc:bean-name />
    <!--
    <mvc:tiles />
    -->
    <mvc:jsp prefix="/WEB-INF/views/" />
</mvc:view-resolvers>

<!--
<mvc:tiles-configurer>
    <mvc:definitions location="/WEB-INF/tiles/tiles-definitions.xml" />
</mvc:tiles-configurer>
-->

Now that you don't need /WEB-INF/tiles/tiles-definitions.xml, delete the Tiles directory itself.

2.4 (Bonus) Header and footer are automatically added by the function of web.xml.

Headers and footers can be added automatically by modifying /webproject/src/main/webapp/WEB-INF/web.xml. <include-prelude> and <include-coda> include another JSP at the start and end of the JSP.

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <el-ignored>false</el-ignored>
        <page-encoding>UTF-8</page-encoding>
        <scripting-invalid>false</scripting-invalid>
        <include-prelude>/WEB-INF/views/common/include.jsp</include-prelude>
        <include-prelude>/WEB-INF/views/common/header.jsp</include-prelude>
        <include-coda>/WEB-INF/views/common/footer.jsp</include-coda>
    </jsp-property-group>
</jsp-config>

You can define multiple <jsp-property-group> itself. Therefore, it is possible to display headers, footers, and menus for specific screen groups, but not for specific screen groups. These contents can be done with JSP alone or Tiles, so it can be said that the important thing is the design policy.

3. Finally

This time I explained how to remove Tiles from TERASOLUNA 5.x blank project. I think View implementation technology is important for MVC applications. There are many different technologies (libraries) out there, so I wanted to be able to select the ones that can easily implement View according to the project characteristics.

Recommended Posts

How to remove Tiles from TERASOLUNA 5.x blank project
How to change a TERASOLUNA 5.x blank project to support PostgreSQL
How to migrate from JUnit4 to JUnit5
protocol buffeer migration from 2.x to 3.x
How to realize huge file upload with TERASOLUNA 5.x (= Spring MVC)
Rails on Tiles (how to write)
Addicted to project imports from GitHub
How to make a Maven project
How to change from HTML to Haml
[Swift] Summary of how to remove elements from an array (personal note)
[Rails] How to convert from erb to haml
How to call Swift 5.3 code from Objective-C
How to remove Alfresco CE tracking tags
[Flutter] How to use C / C ++ from Dart?
Java: How to send values from Servlet to Servlet
[Rails 5.x] How to introduce free fonts
[Ruby] How to convert from lowercase to uppercase and from uppercase to lowercase
How to link Rails6 Vue (from environment construction)
How to add / remove Ruby on Rails columns
How to get a heapdump from a Docker container
How to dump from database (DB) to seeds file
How to get Class from Element in Java
[1st] How to create a Spring-MVC framework project
[Java] How to switch from open jdk to oracle jdk
How to get SIMD optimization from HotSpot JavaVM
[ruby] How to receive values from standard input?