"Boulatian, Misak" wrote:
> Hi Oleg,
>
> Thanks for responding. We were trying to use struts library. The only thing
> I don't like about it is that for every request the action servlet is
> instantiating (class.forname call) the object and then calls perform method
> of that object. So, If your action classes are not servlets themselves then
> every single thread will be using a new instance of that class.
Um, that is *not* the case. Only one instance of an action class ever gets created
for any particular mapping, and that instance is reused for all subsequent requests
-- in the same manner that the servlet container instantiates only one instance of
the servlet.
A consquence of this is that you must program your actions in a thread-safe manner.
> In cases
> where you need to access session beans (EJB) then there is no init method
> for placing these calls to do only once. That is why we are still evaluating
> struts but have not made any decisions yet. Let me know if I am wrong.
>
The best place to initialize stuff at application startup is in the init() method
of the controller servlet, or in some other servlet that you mark <load-on-startup>
in the deployment descriptor. Make these resources available to your actions (and
your JSP pages) by storing them as servlet context attributes (in JSP terms, these
are application scope beans).
>
> Thanks,
> Misak
>
Craig McClanahan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets