The 9 JSP implicit objects are,
Test the code with the following URL in the browser,
- request (HttpServletRequest)
- response (HttpServletResponse)
- out (JspWriter)
- session (HttpSession)
- config (ServletConfig)
- application (ServletContext)
- page (Object)
- pageContext (PageContext)
- exception (Throwable)
Create a JSP - ImplicitObjectsDemo.jsp - in the WebContent folder of the web application,
<html>
<head>
<title>Implicit Objects Demo</title>
</head>
<body>
<%= "test = " + request.getParameter("test") %>
<% response.setHeader("MyHeader", "MyValue"); %>
<br/><br/>
<%= "Session Id= " + session.getId() %>
<br/><br/>
<%= "Servlet API version supported (through ServletContext): " + application.getMinorVersion() + "." + application.getMinorVersion() %>
<br/><br/>
<%= "The JSP Servlet name (through ServletConfi) " + config.getServletName() %>
<br/><br/>
<%= "JSP Servlet class name (through page) is " + page.getClass().getName() %>
</body>
</html>
http://localhost:8080/WebAppName/ImplicitObjectsDemo.jsp?test=abcd
No comments:
Post a Comment