Java Servlet Programing Laungage

Java Servlet Projects

Servlet Project 3

Java Servlet :Commonly used methods of ServletContext interface
adplus-dvertising
Previous Home Next
  1. getInitParameter() is used to obtain the value of an initialization parameter.
    Syntax
    		public String getInitParameter(String pName);
    		
  2. getInitParameterNames() returns an enumeration for the name of all initialization parameters stored in ServletContext object.
    Syntax
    		public Enemeration getInitParameterNames();
    		
  3. setAttribute() is used to store an attribute in application scope.
    Syntax
    		public void setAttribute(String name,Object value);
    		
  4. getAttribute() is used to obtain the value of an attribute.
    Syntax
    		public Object getAttribute(String name);
    		
  5. getAttributeNames() returns an enumeration for all the attributes saved in application scope.
    Syntax
    		public Enumeration getAttributeNames();
    		
  6. removeAttribute() is used to remove an attribute from the application scope.
    Syntax
    		public boolean removeAttribute(String name);
    		
  7. getContext() is used to obtain the reference of ServletContext object of the specify application.
    Syntax
    		public ServletContext getContext(String appName);
    		
  8. getRequestDispatcher() is used to obtain a requestDispatchet object.
    Syntax
    		public RequestDispatcher
    		getRequestDispatcher(String url of Resource);
    		
  9. getRealPath() is used to find out actual path of resource an a server.
    Syntax
    		
    		public String getRealPath(String url);
    		
    		
Previous Home Next