Sunday, 20 March 2016

How to enable the Invoker Servlet ?


The invoker servlet lets you run servlets without first making changes to your Web application's deployment descriptor (i.e., the WEB-INF/web.xml file).
Instead, you just drop your servlet into WEB-INF/classes and use the URL http://host/servlet/ServletName (or http://host/webAppName/servlet/ServletName) once you start using your own Web applications.
The invoker servlet is extremely convenient when you are learning and even when you are doing your initial development.

To enable the invoker servlet, uncomment the following servlet and servlet-mapping elements in install_dir/conf/web.xml

Don't confuse this Apache Tomcat-specific web.xml file with the standard one that goes in the WEB-INFdirectory of each Web application.

<servlet>       
   <servlet-name>invoker</servlet-name>       
   <servlet-class>org.apache.catalina.servlets.InvokerServlet</servlet-class>
   ...   
</servlet>
<servlet-mapping>       
   <servlet-name>invoker</servlet-name>       
   <url-pattern>/servlet/*</url-pattern>   
</servlet-mapping>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.