Jsp Implicit Object

Jsp Implicit Object: To simplify code in scripting element jsp is provided with implicit objects.

JSP supports nine Implicit Objects:

request: This is the HttpServletRequest object associated with the request. It lets you look at request parameter and header.

response: This is the HttpServletResponse object associated with the response to the client. Just as the server creates the request object, it also creates an object to represent the response to the client.

out: It is the PrintWriter object used to send output to the client. In scriptlets, need to refer to out explicitly in case we need to display anything. We use this as out.print()

session: It is the HttpSession object associated with the request. A session object is created and this variable is bound even if there is no incoming session reference

application: It is the ServletContext object associated with application context as obtained via getServletConfig.getContext(). It is created when jsp is initialized and removed once jsp is destroyed.

config: It is the ServletConfig object associated with the page.

pageContext: This encapsulates use of server-specific features like higher performance JspWriters. The pageContext object represents the environment for the page, containing useful information like page attributes, access to the request, response and session objects, as well as the JspWriter referenced by out.

For example, to forward a request to another resource from in a JSP page, we can do that by using the pageContext variable:

pageContext.forward ("abc.jsp");

page: The page object represents the generated servlet instance itself, i.e., it is same as the "this" keyword used in a Java file and is used to call the methods defined by the translated servlet class.

Exception: It allows the exception data to be accessed by designated JSP. It is accessible by JSP error page only.They must have isErrorPage attribute set to true.

( function() { if (window.CHITIKA === undefined) { window.CHITIKA = { 'units' : [] }; }; var unit = {"calltype":"async[2]","publisher":"manishh03","width":300,"height":250,"sid":"Chitika Default"}; var placement_id = window.CHITIKA.units.length; window.CHITIKA.units.push(unit); document.write('
'); }());