• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in jsp implicit objects......

 
Jeevitesh Singh
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • 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.

 
Tyler Wright
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic