Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Implicit objects in jsp  RSS feed

 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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' ?


Pls clarify.

Cheers
Arvind
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Bill
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Arvind Sampath
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff,

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 ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!