Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Implicit objects in jspInit() method

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are implict objects available in jspInit() method or are they available in _jspService() method? For example, can the following code rewritten using implicit objects?

 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jacob,
config and application objects are always availabe inside the jspInit().Bcoz they are given by the container which you can use it to initialize the jsp's servlet.
 
Jacob Thomas
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much for your reply Senthil. I was confused because all the implicit objects seem to be explicitly initialized in the _jspService() method of the example given in the HFSJ book. If they are explicitlt initalized in the _jspService() method, how are they available in the jspInit() method?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Senthil Kumar wrote:jacob,
config and application objects are always availabe inside the jspInit(). Because, they are given by the container which you can use it to initialize the jsp's servlet.



Senthil,

I just tried to access the config object in the jspInit method and I had an error come up. Both a compile error and a run-time error.

So, you're completely wrong about the config and application objects being available in the jspInit method.
 
Creator of Enthuware JWS+ V6
Posts: 3348
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

Are implict objects available in jspInit() method or are they available in _jspService() method? For example, can the following code rewritten using implicit objects?



Good question, and you can't really get a clear answer from the specs, but you can deduct an answer from it.


JSP.11.2.1 API Contracts
void jspInit() Method is optionally defined in JSP page. Method is invoked when the JSP page is initialized. When method is called all the methods in servlet, including getServletConfig are available


No talk about implicit objects here, so we assume they are not available yet, going further into the specs:

Code Example JSP.11-2 The Java Class Generated From a JSP Page

Deduction from above: The implicit objects are only available in the _jspService() method.

Regards,
Frits
 
The human mind is a dangerous plaything. This tiny ad is pretty safe:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic