JSP
Pax Web has support for Java Server Pages (JSP) via using Tomcat Jasper 2
Why
Quoted from Java Server Pages home page:
JavaServer Pages (JSP) technology provides a simplified, fast way to create dynamic web content. JSP technology enables rapid development of web-based applications that are server- and platform-independent.
How does it work
First of all you must have your JSPs (not mandatory but useful). Then you have to let Pax Web know that you have jsps by calling the registerJsps()
method on WebContainer.
At runtime you have to also deploy the jsp support bundle org.ops4j.pax.web.jsp (see ops4j:installation instructions bellow) toegether with Pax Web.
You can find an example of the example page.
Tag Libs
In order to get your custom tag libs working your TLD files will have to be reachable in your bundle in "special" places:
- all tld files in any jar referenced by your Bundle-ClassPath manifest entry
- all tld files in WEB-INF directory or sub-directory of WEB-INF in your bundle jar
Imported packages are being searched too as of 1.1.2 and 2.0.0. See PAXWEB-86 and PAXWEB-130. PAX Web JSP's only scans the META-INF/ directory within each imported (Import-Package) or required bundle (Require-Bundle), thus mimicking Jasper's behaviour when searching JAR files for TLDs.
Enable JSP support
public void registerJsps( String[] urlPatterns, HttpContext httpContext )
Enables jsp support. For more details take a look here.
urlPatterns |
An array of url patterns this jsp support maps to. If null, a default "*.jsp" will be used |
httpContext |
The http context for which the jsp support should be enabled. If null a default http context will be used. |
Throws |
|
Disable JSP support
public void unregisterJsps( HttpContext httpContext )
Disable jsp support.
httpContext |
The http context for which the jsp support should be disabled |
Throws |
|
Throws |
|