Forward servlet ver. 1.1

This servlet lets you implement clean url's in your web applications. Servlet is acting as a front controller to your JSP files. E.g. you can have an original request /servlet/foo/bar and serve it as /foo/bar.jsp. Servlet automatically forwards original requests to the appropriate JSP's processing depends on the path.

How to use this servlet:

a) download forwardPackage.jar and save it in WEB-INF/lib

b) describe this servlet in web.xml file. Servlet accepts the following initial parameters:
dir - Describes an existing directory on your server for the JSP files
default - Optional parameter. Describes a path for JSP file that will be processed by default (if generated path does not exist)

For example:


c) describe a mapping for this servlet in web.xml file. E.g.:


and in this case request to /api/get will be served as /WEB-INF/get.jsp, /api/put will be served as /WEB-INF/put.jsp etc. And if file /WEB-INF/head.jsp does not exist than /api/head will be served as /WEB-INF/default.jsp

In this example we hide actual JSP files under WEB-INF directory and prevent direct access to them.

   For downloading:

    Forward servlet:  forwardPackage.jar

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: