Latest news

JavaRebel 1.2.1 and Spring Plugin 1.0-M2 Released

We are very proud to present not one, but two simultaneous releases....

JavaRebel used to develop LinkedIn

LinkedIn, Corp. has purchased JavaRebel licenses for all its Java engineers to use in the well-known social networking website dev...

JavaRebel 1.2: Now With Full Spring Support

The latest stable release of the JavaRebel code reloading agent includes a plugin for Spring that reloads Spring configuration on-...

Installation

JSP Weaver installation does not alter your application’s current configuration. JSP Weaver does not force you to add any dependencies from external frameworks or libraries. Installation procedure is as simple as shown below:

  • Download latest release from here.
  • Copy downloaded jar to your application WEB-INF/lib folder
  • Modify your web.xml file by adding a JspInterpretingServlet servlet as servlet-class and map all JSP files to it, e.g.:
  <servlet>
    <servlet-name>weaverServlet</servlet-name>
    <servlet-class>
    com.zeroturnaround.jspweaver.JspInterpretingServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>weaverServlet</servlet-name>
    <url-pattern>*.jsp</url-pattern>
  </servlet-mapping>

Start the server or application as usual. If JSP Weaver was installed successfully you should see a message like this:

##########################################################

 ZeroTurnaround JSP Weaver x.y.z
 ...

##########################################################

and JSP files will be interpreted by JSP Weaver.

Oracle Application Server 9.x / 10.x

Oracle Application Servers need a little extra configuration as they do not allow to remap JSP servlets. In addition to the modification of web.xml the file %DOMAIN_HOME%\j2ee\home\config\global-web-application.xml needs to be changed. Find the following lines:

    <servlet-mapping>
      <servlet-name>jsp</servlet-name>
      <url-pattern>/*.jsp</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
      <servlet-name>jsp</servlet-name>
      <url-pattern>/*.JSP</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
      <servlet-name>jsp</servlet-name>
      <url-pattern>/*.jspx</url-pattern>
    </servlet-mapping>

Comment these lines out with the XML comment tags <!– … –>.

Custom settings

By default JSP Weaver only finds JSP files from the servlet path. This can be altered by a servlet parameter classpath-virtual-folder. All JSP files prefixed by this folder name in the URL will be searched from the CLASSPATH. See the following example.

  <servlet>
    <servlet-name>weaverServlet</servlet-name>
    <servlet-class>
    com.zeroturnaround.jspweaver.JspInterpretingServlet
    </servlet-class>
    <init-param>
      <param-name>classpath-virtual-folder</init-param>
      <param-value>/classpath</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>weaverServlet</servlet-name>
    <url-pattern>*.jsp</url-pattern>
  </servlet-mapping>

For example, a requet to “http://www.domain.com/myApp/classpath/myFolder/hello.jsp” now refers to the “myFolder/hello.jsp” found from the class path (WEB-INF/classes folder, any of the JAR files in WEB-INF/lib etc) instead of the servlet path. The prefix itself (”/classpath”) is omitted from the actual location.

Verifier Utility

JSP Weaver Verifier scans all JSP files in the specified directory or WAR file
for parsing errors.

To run the utility execute the com.zeroturnaround.jspweaver.JspVerifier
class in the jspweaver.jar.

  java -classpath ... com.zeroturnaround.jspweaver.JspVerifier <WAR file or directory>

If the last argument is missing current directory will be scanned.

The classpath must contain jspweaver.jar, j2ee.jar and
the used tag libraries with their dependencies.