Caffeine Coder
Caffeine Coder

Reputation: 1176

What is the usage of JSP compiler?

Recently I started working on a maven based Struts project using JSP and Java 7. I see the dependency in pom as following.

<plugin>
            <groupId>org.jasig.mojo.jspc</groupId>
            <artifactId>jspc-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <sources>
                    <directory>${basedir}/src/main/webapp/</directory>
                    <includes>
                        <include>**/*.jsp</include>
                    </includes>
                </sources>
                <includeInProject>false</includeInProject>
                <validateXml>false</validateXml>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.jasig.mojo.jspc</groupId>
                    <artifactId>jspc-compiler-tomcat8</artifactId>
                    <version>2.0.2</version>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-jdk14</artifactId>
                    <version>1.5.3</version>
                </dependency>
            </dependencies>
        </plugin>

I removed it and build project successfully. The UI of application works fine. Can someone please help me in understanding the usage of this plugin?

Upvotes: 0

Views: 583

Answers (1)

Dave Newton
Dave Newton

Reputation: 160271

JSP pre-compilers avoid a JSP compilation delay when a JSP page is first hit.

It is an optimization that may or may not be actually worth it, but for high-page-count high-usage sites that use server-side HTML generation it may be worth it.

For example, see https://www.mulesoft.com/tcat/tomcat-jsp


Meta

Questions like this can be self-answered by searching the web. The first step is to identify what you're looking at, which it appears you did, since you identified the dependency as a JSP compiler.

Once you know what you're trying to look for, ask the web "why use a JSP compiler" or something similar. The reference I posted above was one of the early results when I searched for this.

Upvotes: 1

Related Questions