Javatpoint Logo
Javatpoint Logo

ServletActionContext class

The ServletActionContext class provides methods to get HttpServletRequest, HttpServletResponse, ServletContext and HttpSession objects.

It is a convenient class and prefered than ActionContext class.

Methods of ServletActionContext class

The commonly used methods provided by ServletActionContext class are as follows:

  1. public static HttpServletRequest getRequest() returns the instance of HttpServletRequest.
  2. public static HttpServletResponse getResponse() returns the instance of HttpServletResponse.
  3. public static ServletContext getServletContext() returns the instance of ServletContext.

How to obtain instance of HttpSession ?

If we have the instance of HttpServletRequest class, we can call the getSession() method of HttpServletRequest interface to get the instance of HttpSession. For example:


We are going to see the full example of this in next topic SessionAware interface.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA