Contents
Aim
Create a JSP page to request implicit object.
Theory
There are 9 JSP implicit objects. These objects are created by the web container that are available to all the jsp pages.
The available implicit objects are as given below:
| Object | Type |
| out | JSPWriter |
| request | HttpServletRequest |
| response | HttpServletResponse |
| config | ServletConfig |
| application | ServletContext |
| session | HttpSession |
| pageContext | PageContext |
| page | Object |
| exception | Throwable |
out Object
For writing any data to the buffer, JSP provides an implicit object named out. It is the object of JspWriter.
<% out.print("Today is:"+java.util.Calendar.getInstance().getTime()); %>
request Object
The JSP request is an implicit object of type HttpServletRequest i.e. created for each jsp request by the web container. It can be used to get request information such as parameter, header information, remote address, server name, server port, content type, character encoding etc.
<%
String name=request.getParameter("uname");
out.print("welcome "+name);
%>
response Object
In JSP, response is an implicit object of type HttpServletResponse. The instance of HttpServletResponse is created by the web container for each jsp request. It can be used to add or manipulate response such as redirect response to another resource, send error etc.
<% response.sendRedirect("https://www.andhrauniversity.edu.in"); %>
config Object
In JSP, config is an implicit object of type ServletConfig. This object can be used to get initialization parameter for a particular JSP page. The config object is created by the web container for each jsp page.
<%
String name = config.getInitParameter("uname");
%>
application Object
In JSP, application is an implicit object of type ServletContext. The instance of ServletContext is created only once by the web container when application or project is deployed on the server.
This object can be used to get initialization parameter from configuaration file (web.xml). It can also be used to get, set or remove attribute from the application scope.
<%
String name = application.getInitParameter("uname");
%>
session Object
In JSP, session is an implicit object of type HttpSession.The Java developer can use this object to set, get or remove attribute or to get session information.
<%
session.setAttribute("user",name);
%>
Program
index.jsp
<html>
<head>
<title>Welcome</title>
</head>
<body>
<% out.print("Printed using the out implicit object."); %>
</body>
</html>
Input and Output
index.jsp

Suryateja Pericherla, at present is a Research Scholar (full-time Ph.D.) in the Dept. of Computer Science & Systems Engineering at Andhra University, Visakhapatnam. Previously worked as an Associate Professor in the Dept. of CSE at Vishnu Institute of Technology, India.
He has 11+ years of teaching experience and is an individual researcher whose research interests are Cloud Computing, Internet of Things, Computer Security, Network Security and Blockchain.
He is a member of professional societies like IEEE, ACM, CSI and ISCA. He published several research papers which are indexed by SCIE, WoS, Scopus, Springer and others.


Leave a Reply