What are the implicit objects in JSP & differences between them

Showing Answers 1 - 4 of 4 Answers

Santhosh

  • May 31st, 2005
 

There are nine implicit objects in JSP. 
1. pageContext 
2. session 
3. request 
4. response 
5. exception 
6. out 
7. application 
8. config 
9. page 
These are used for different purposes and actually u no need to create these objects in JSP. JSP container will create these objects automatically. 
You can directly use these objects. 
Example: 
If i want to put my username in the session in JSP. 
JSP Page: 
<% 
String name=request.getParameter("Username"); 
session.setAttribute("UserName",name); 
%> 
In the about page, i am using session object. But this session object is not declared in JSP file, because, this is implicit object and it will be created by the jsp container. 
If u see the java file for this jsp page in the work folder of apache tomcat, u will find these objects are created. 
 
 
 
 

ImplictObject                                         API

1)out                                                  JspWriter
2)Request                                          HttpServletRequest
3)Response                                        HttpServletResponse
4)session                                           HttpSession
5)page                                               Object
6)PageContext                                   PageContext
7)Application                                       ServletContext
8)Config                                              ServletConfig
9)Exception                                         JspException

using the implict objects you can take the advantage of the servletness eventhough you are not directly using the servlet yourself

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions