• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

doubt in jsp implicit objects......

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
we have a implicit object application in jsp.
we know that servletcontext attributes and parameters are available to all the servlets and
jsp's in a particular application...so we write
getServletContext().getInitparameter("foo");
in servlet..........
and we write
application.getInitparameter("foo");
in jsp....
so my question is if both jsp and servlet are in same app...
then that means implicit application object is the same as the one we get from getServletContext()
because we only have one servletcontext per web app.

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeevitesh,
If you look in a complied JSP source file: name_jsp.java file (which in tomcat is located in <tomcat-root>/work/Catalina/localhost/<appname>/org/apache/jsp), you will see the explicit delcaration and assignment of:



If you look at the API for javax.servlet.jsp.JspFactory, you will see that this method returns a javax.servlet.jsp.PageContext object. If you study the PageContext, I think you will arrive at the answer to your question which I believe is YES.

However, I could be wrong...so please anyone correct me.

regards,
Tyler.
 
You showed up just in time for the waffles! And this tiny ad:
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
reply
    Bookmark Topic Watch Topic
  • New Topic