A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Web Component Certification (SCWCD/OCPJWCD)
implicit jsp objects
Joined: Feb 07, 2005
Dec 18, 2006 21:49:00
Implicit objects are not available inside jspInit() or jspDestroy() method.That means implicit objects are available in _jspService() method only.
is it so?
Joined: Nov 16, 2005
Dec 18, 2006 21:58:00
yes. Implicit objects are available only in _jspService() method. In
, you can access those in scriplets, expressions but not in declaration(because it goes out side _jspService method on converted
Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />firstname.lastname@example.org
Joined: Dec 14, 2006
Dec 18, 2006 22:00:00
Hey we can access implicit object inside jspInit()/jspDestroy() method.
config implicit object.
Thanks and regards,
Joined: Oct 12, 2006
Dec 18, 2006 22:02:00
The implicit objects are the local variables inside the _jspService method. So jspInit() and jspDestroy() have no access to it.
Joined: Oct 17, 2006
Dec 19, 2006 06:15:00
Just to throw more light on this topic.
The _jspService() method is responsible for producing all the implicit objects (session, config, application, config etc). This is done at the very beginning of the _jspService() method.
An example of how the _jspService() method in a converted servlet looks like:
public void _jspService(HttpServletRequest request, HttpServletResponse response)
_jspxFactory = null;
pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
out = null;
Object page = this;
_jspx_out = null;
_jspx_page_context = null;
_jspxFactory = JspFactory.getDefaultFactory();
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
Thus any scriptlet or expression is able to use these local implicit objects as they are initialized at the beginning of _jspService() only.
The statement that "Implicit objects cannot be used outside _jspService method" is very much true due to their local nature.
Stay connected, Remain beautiful
1.4, SCWCD 1.4
Joined: Oct 16, 2005
Dec 19, 2006 10:11:00
well said abhijeet ! and i like your signature ...
Stay connected, be beautiful
SCJP 1.4 - 95%
[ My Story ]
- SCWCD 1.4 - 91%
[ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
I agree. Here's the link:
subject: implicit jsp objects
implicit object in Tag file
JSP Implicit objects
HttpSession in JSF
Implicit Objects available in Tag Files
tag files and implicit objects
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015