JSP Templates


Development

During the development cycle, it is often convenient to use a global invoker for all of the servlets in an application, as shown in the following <servletmapping>:

 <servlet-mapping>   <url-pattern>/servlet/*</url-pattern>   <servlet-name>invoker</servlet-name> </servlet-mapping> 

In this mapping, all URLs that have the text servlet followed by another text string will be captured as servlets. The <servlet-name> uses a default value of invoker. By using invoker, you tell Resin to take the last string and use it as the servlet classname. For example:

 /servlet/login 

This URL attempts to find a servlet with a classname of login. We don't recommend using the invoker for the <servlet-name> value in a production environment because any string used in the URL is used as a possible servlet name. If you have a servlet named LoginServlet, the following URL works fine:

 /servlet/LoginServlet 

However, this one does not:

 /servlet/aLoginServlet 

The server returns an error stating that it can't find the URL.




Mastering Resin
Mastering Resin
ISBN: 0471431036
EAN: 2147483647
Year: 2002
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net