JSP implicit objects are created during the
translation phase of JSP to the servlet and it is created by the web container.
JSP implicit objects can be accessed using
objects and these objects can be directly used in scriplets that goes in the
service method.
Types:
There are 9 types of jsp implicit objects,they are
request implicit object
The JSP implicit request object is type of javax.servlet.http.HttpServletRequest
interface. It represents the request made by the client. It can be used to get request
information such as parameter, header information, remote address, server name,
server port, content type, character encoding etc.It is used to get,set or remove attribute from the request scope.
response implicit object
The JSP implicit response object is an instance of a java
class that implements the javax.servlet.http.HttpServletResponse interface. It
represents the response to be given to the client. It can be used to add or manipulate
response such as redirect response to another resource, send error etc.
out implicit object
The JSP implicit out object is type of javax.servlet.jsp.JspWriter class. It
represents the output content to be sent to the client. The out implicit object
is used to write the output content.
session implicit object
The JSP implicit session object is an instance of a java
class that implements the javax.servlet.http.HttpSession interface. It is used to set,get or remove
attribute or to get session information.. The session implicit object is used to
store session state for a single user.
application implicit object
The JSP implicit application object is an instance of a java class that implements the javax.servlet.ServletContext interface.This object can be used to get initialization parameter from configuration file(web.xml).This initialization parameter can be used by all jsp pages and also it is used to get,set or remove attribute from the application scope.
exception implicit object
The JSP implicit exception object is type of java.lang.Throwable
class. It is available in JSP error pages only. it can be used to print the exception and It represents the
occured exception that caused the control to pass to the JSP error page.
config implicit object
The JSP implicit config object is an instance of a java class that implements the javax.servlet.ServletConfig interface.This object can be used to get initialization parameter for a particular JSP page from configuration file(web.xml).The config
object is created by the web container for each jsp page.
page implicit object
The JSP implicit page object is type of java.lang.Object class. It represents the
current JSP page. That is, it serves as a reference to the java servlet object
that implements the JSP page on which it is accessed. It is less used because it consumes large
memory.
pageContext implicit object
The JSP implicit pageContext object is an instance of the
javax.servlet.jsp.PageContext abstract class. It provides useful context
information. It provides methods to get and set attributes in different
scopes and for transferring requests to other resources.
The pageContext object
can be used to set,get or remove attribute from one of the following scopes,they are
page
request
session
application
Note:
|
In JSP, page scope is the
default scope.
|
Python is an open-source, high level, interpreted programming language which offers great opportunities for object-oriented programming. Choosing a python training program from Red Prism Group, which is best training institute for python in noida.
ReplyDelete