JSP Implicit Objects
There are 9 jsp implicit objects are available to all jsp pages, which are created by the web container. JSP Implicit Objects are also called pre-defined variables.
- page: This is a synonym for this. This is used to call methods defined by the translated servlet class.
- out : This is the PrintWriter object which is used to print output.
- request: This is the HttpServletRequestobject which is associated with the request.
- response: This is the HttpServletResponseobject which is associated with the response.
- session: This is the HttpSession object which is associated with request.
- application: This is the ServletContext object which is associated with application context.
- config: This is the ServletConfig object associated with the page.
- pageContext: This is the object PageContext
- Exception: The Exception object allow the exception data to be accessed by designated JSP.
- page: This implicit object is assigned a reference to the servlet. Page is a instace of JSP page’s servlet processing the current request.This is a synonym for this, it means we can simpy use this keyword in place of page implicit object. This used to call methods defined by the translated servlet class.
- out: This implicit object is used to writing data to the buffer. This is the object of PrintWriter, but we don’t to create its object in JSP like Servlet.
The Servlet Syntax is
<%out.print(“Welcome to W3adda.com);%>
Example: In this example we are simply displaying our message.
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<% out.print("Welcome to W3adda.com");%>