How to find a servlet object by name?

Ads
 

How to find a servlet object by name?

How can we locate a servlet object in the code by it's object name?

View Answers

May 11, 2012 at 1:11 PM

A. In web.xml you map servlet and define url pattern. Now this url-pattern is used for calling servlet.

<servlet>
    <servlet-name>MyServlet</servlet-name>
    <servlet-class>roseindia.MyServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name> MyServlet </servlet-name>
    <url-pattern>/ MyServlet </url-pattern>
  </servlet-mapping>

A Servlet can get a list of all other Servlets in the Servlet Context by calling getServletNames on the ServletContext object. ServletContext is available through the ServletConfig object's getServletContext method. After obtaining the reference to another Servlet that Servlet's methods can be called.

Ads









Related Tutorials/Questions & Answers:
How to find a servlet object by name?
how many ways are there to invoke a servlet object?
Advertisements
ORDAudio object in servlet
Servlet Scope object
how to generate a bar chart on a JSP PAGE using the arraylist object passed form the servlet.(using jfreechart)
Pass a dom object from jsp to servlet
How to call servlet in JSP?
How to use Servlet and Ajax?
ModuleNotFoundError: No module named 'project-namer'
ModuleNotFoundError: No module named 'project-namer'
ModuleNotFoundError: No module named 'rpg-namer'
ModuleNotFoundError: No module named 'project-namer'
How to find maximum value in ArrayList
How to find maximum value in ArrayList
How to find maximum value in ArrayList
How to find maximum value in ArrayList
how to find jdk path in ubuntu?
How to find hashtable size in Java?
How to Find PHP version and configuration?
ModuleNotFoundError: No module named 'photo-namer-nautilus'
how to get type names of elasticsearch index in python
how to write servlet program in eclipse?
how to fetch data from servlet ????
how to get session object in simple java class??
how to find which user has modified the file
How to find a config file in spring project
how to create servlet
ModuleNotFoundError: No module named 'find'
ModuleNotFoundError: No module named 'find'
How to make focus on an object, make focus on an object, focus on an object
Names

Ads