On Thu, 27 Jun 2002, Heligon Sandra wrote:

> Date: Thu, 27 Jun 2002 11:09:47 +0200
> From: Heligon Sandra <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: ServletContextListener vs ActionServlet/RequestProcessor sub
>     clas sing
>
>
>       I would like to add comments on my previous message about
> ServletContextListener and
>       ActionServlet sub classing. I read that with Struts1.1 it is bad to
> create ActionServlet subclass ,
>       because a new class RequestProcessor has been added.
>       So my new question is, single initialisations (as database
> connection or ORB initialisation)
>       must be done in ServletContextListener class
>       or RequestProcessor sub classing (in this case which method use ?, I
> don't look any init() method).
>

See previous response.

Note that the Struts PlugIn API in 1.1 is designed to replace the need to
subclass ActionServlet if the *only* thing you need to do is add some
extra initialization stuff.  It has the same advantages (runs under
Servlet 2.2 environments) and disadvantages (lifecycle is not guaranteed)
as overriding init() and destroy() on ActionServlet itself.

>       I don't understand why the RequestProcessor has been created ? Do
> this class implement new
>       features/methods in comparison with ActionServlet ?
>       Or do these two classes not work in the same context ? For example a
> RequestProcessor  is
>       associated to a single application whereas an ActionServlet instance
> can be shared between several
>       applications ?
>       In this case we can yet need to subclass the ActionServlet class.
>       Has somebody an example ? I work on a little web application and I
> don't understand well the
>       notion of sub-application or multiple applications and the
> difference with multiple Action
>       instances.
>

It was created so that advanced users could have different request
processing lifecycles for different sub-applications if they need them.
For the vast majority of Struts developers, you can just forget that this
thing even exists.

Sub-applications are not well documented yet (that is being worked on),
but the basic idea is that you can have multiple independent
struts-config.xml files in the same webapp, sharing the same controller
servlet underneath.  Sub-applications are distinguished by a prefix, so
you might have context-relative requests like "/catalog/showCategory.do"
and "/checkout/acceptCreditCard.do" served by different subapps.

This will be explained better (with examples) in the final docs.

>       Thanks in advance.
>       Sandra
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to