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
How to get jSon object in servlet from jsp - JSP-Servlet
How to revert back ServletInputStream object after reading once. - JSP-Servlet
how to find a dynamic string in a string & how to replace tgat wth with another string - JSP-Servlet
ORDAudio object in servlet
Page object - JSP-Servlet
Servlet Scope object
How to disable an HTML object?
Names
how to generate a bar chart on a JSP PAGE using the arraylist object passed form the servlet.(using jfreechart)
Object-Oriented programming - Java Beginners
To find the reminder for a double - JSP-Servlet
How to sort json object?
how to find jdk path in ubuntu?
How to find hashtable size in Java?
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 PHP version and configuration?
how to find the given date is sunday
Can not find "org.apache.poi " - JSP-Servlet
find the sql query for the output having two table names ie, homeworklinks,homework_attachments
how to iterate hibernate object
How to find run time in SQL.
How to use find method in Java - Java Beginners
get a session object - JSP-Servlet
how to find which user has modified the file
How to find a config file in spring project
Pass a dom object from jsp to servlet

Ads