Neeraj Vora wrote:
> I played with jspInit method in the JSP page and to my dismay found that
> within this method I don't have access to the application object or the
> beans that specified using <jsp:useBean> syntax. Am I missing something?
jspInit is called before anything else happens. Naturally, don't expect to see
beans imported using useBean in the body of jspInit.
See section on Implicit objects in the spec. It says these implicit objects are
accessible only withing scriptlets or expressions, not withing declarations or
jspInit().
You can use the Servlet API to get hold of the "application" object like this:
getServletConfig().getServletContext() in jspInit().
> For the beans I use in my JSP page I don't see the constructor being called
> at all. I'm sure this can't be true but am at a loss why I don't see the
> code in the constructor not being run.
They should be the first time or every time depending on the scope. If they are
not, send me a simple page and bean and I'll check this with JSWDK 1.0 final and
fix it if necessary.
> Is there a way in the JSP environment to specify that a JSP page is
> pre-compiled and all the beans it uses are pre-initialized before the first
> request? I suspect this is more to do with the server, but still how could
> it be done. Are there tools available to convert my JSP page to a servlet
> that I could use with hosting providers who have servlets but not the JSP
> engine?
See the JSP 1.1 spec; it is moving in this direction. Pre-initializing beans is not
something we've looked at: its not very expensive especially compared to JSP page
generation and compilation.
>
>
> _______________________________________________________________
> Get Free Email and Do More On The Web. Visit http://www.msn.com
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
--
Peace, Anil +<:-)
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html