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.
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
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.
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.
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.
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