Originally posted by Arvind Sampath:
Why are implicit objects, other than request/response required in a jsp ? Lets take the example of a session object. Why do we require such an implicit object when we can create them explicitly ? Is there any other reason other than 'lets make things easy for the developer, he's already typed so much code' ?
Yes, you could have gotten the session from the request, but predefined variable out, for example, is not the same as response.getWriter() -- see JspWriter for details.
Also, I don't know how you would get a hold of predefined variable pageContext in any other way.
pageContext and out refer to objects, as you said, to which a reference cannot be obtained explicity. In these cases,i can appreciate the role that implicit objects play. But in certain other cases, like the session object, where it is possible to obtain a reference to them explicitly, why do we require an implicit object ?
The implicit objects are there to simplify programming - thats the whole thrust of JSP, simplifying common tasks. If you want to twiddle the bits directly, use a servlet.
This is what i infer. HTML programmers with little java knowledge might benefit from this as the tasks of getting a session object from session,etc are done by the JSP container and they can use the implicit references. Am i right, william ?
[ February 02, 2006: Message edited by: Arvind Sampath ]