What is the right way of writing the code to get the servlet information using public String getServletInfo()?

Showing Answers 1 - 11 of 11 Answers

barsana

  • Nov 16th, 2005
 

The information entered in Info attribute of page directive can then be accessed viagetServletInfo().

  Was this answer useful?  Yes

dilipiyer

  • Jan 28th, 2006
 

getServletInfo() allows the servlet to return basic information about itself, such as author, version, and copyright.
Usage:
servlet.getServletInfo()    --> Inside doget(..)
Or
<%=getServletInfo()%>   --> Inside JSP

Vamsi

  • Nov 7th, 2007
 

ServeltContext context= getServletContext();
Servlet s= context.getServlet();
s.getServletInfo(); -----------> we can use this in the method

  Was this answer useful?  Yes

mabhijit

  • Jan 11th, 2008
 

Some applets and applications, for example, the Java Web Server Administration Tool, display information about a servlet. This information can include a short description of the purpose of the servlet, its author, and perhaps its version number. So the Servlet API provides a method to return this information, getServletInfo. By default, this method returns null. While servlet writers are not required to override this method, it is strongly recommended.
e.g. : -

public class SimpleServlet extends HttpServlet
   { ...
    public String getServletInfo()
      {
        return "A simple servlet";
      }
   }

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions