The object pageContext is used to access all the information of JSP page. It is an instance of javax.servlet.jsp.PageContext.

The scope of pageContext can be defined explicitly. The object is valid up to the specified scope only. Several layers in which pageContext can be accessed are as follows: –


Methods of pageContext

The various methods of pageContext are as follows: –

  • void setAttribute(String attribute_name,Object attribute_value,int scope):- This method is used to set the attribute.
  • Object getAttribute(String attribute_name,int scope):- This method return the attribute of object type.
  • Object removeAttribute(String attribute_name,int scope):- This method is used to remove the attribute.
  • Object findAttribute(String attribute_name):- This method search the attribute passed within its bracket.

Example of pageContext

This is a simple example that defines the way of set and get the various attributes.



Pin It on Pinterest

Share This