Maven2 pre-compiled JSP

Source: Internet
Author: User

1. Add the following code to pom. xml:
 
<! -- Begin-precompiling jsps -->
 
<Plugin>
 
<GroupId> org. codehaus. mojo </groupId>
 
<ArtifactId> jspc-maven-plugin </artifactId>
 
<Configuration>
 
<InjectString> & lt ;! -- [Insert fragment here] -- & gt; </injectString>
 
<InputWebXml >$ {basedir}/WebContent/WEB-INF/web. xml </inputWebXml>
 
<OutputWebXml >$ {basedir}/target/jspweb. xml </outputWebXml>
 
<WarSourceDirectory >$ {basedir}/WebContent </warSourceDirectory>
 
<Verbose> true </verbose>
 
<Filtering> true </filtering>
 
<Directory >$ {basedir}/WebContent </directory>
 
<Shortdes>
 
<Include> **/*. jsp </include>
 
</Shortdes>
 
</Configuration>
 
<Executions>
 
<Execution>
 
<Id> jspc </id>
 
<Goals>
 
<Goal> compile </goal>
 
</Goals>
 
</Execution>
 
</Executions>
 
</Plugin>
 
<Plugin>
 
<GroupId> org. apache. maven. plugins </groupId>
 
<ArtifactId> maven-war-plugin </artifactId>
 
<Configuration>
 
<WebXml >$ {basedir}/WebContent/WEB-INF/web. xml </webXml>
 
</Configuration>
 
</Plugin>
 
<! -- End-precompiling jsps -->
 
---------------------------------------------------------------
 
Description: www.2cto. com1: <injectString> & lt ;! -- [Insert fragment here] -- & gt; </injectString>
 
Search for the string consistent with the preceding configuration in the web. xml file and insert the pre-compiled servlet code (these are automatically generated ).
 
NOTE 2: <inputWebXml >$ {basedir}/WebContent/WEB-INF/web. xml </inputWebXml>
 
<OutputWebXml >$ {basedir}/target/jspweb. xml </outputWebXml>
 
The web. xml Path of the inputWebXml configuration item, and the web. xml storage path after the precompiled code is inserted in the outputWebXml configuration item.
 
NOTE 3: <warSourceDirectory >$ {basedir}/WebContent </warSourceDirectory>
 
Configure which path to pre-compile the JSP file
 
Note 4:
 
<Plugin>
 
<GroupId> org. apache. maven. plugins </groupId>
 
<ArtifactId> maven-war-plugin </artifactId>
 
<Configuration>
 
<WebXml >$ {basedir}/WebContent/WEB-INF/web. xml </webXml>
 
</Configuration>
 
</Plugin>
 
Configure Maven to create a war package
 
----------------------------------------------------------
 
2. Add the following content to the web. xml file:
 
<! -- [Insert fragment here] -->
 
----------------------------------------------------------
 
Note: insert pre-compiled code. (Some servlet configuration codes are automatically generated)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.