Monday, May 16, 2011

How to add servlet in the WCS

It is so easy .. check my findings

Step 1; Open \web.xml
add below section
<servlet>
 <display-name>MyServlet</display-name>
 <servlet-name>MyServlet</servlet-name>
 <servlet-class>com.mycompany.wcs.servlet.MyServlet</servlet-class>
</servlet>
 <servlet-mapping>
 <servlet-name>MyServlet</servlet-name>
 <url-pattern>/MyServlet</url-pattern>
</servlet-mapping>

Save and restart the server..
That is it.. Servlet is ready

Now create MyServlet.java under com.mycompany.wcs.servlet.MyServlet package
Make sure service() method is available in your servlet .. and your  MyServlet extends HttpServlet

Done..  call your servlet from anywhere ..
Enjoy servlet in wcs :)