No. The init() method is called during servlet startup, not in the context
of a request. No request means no response - there's no place for a JSP to
go. I think you're pretty much stuck with logging an error and/or throwing
an exception.

--
Martin Cooper


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 28, 2001 8:55 AM
Subject: Re: Initial security check


>
>
>
> Hi.  Just one more question on this...
>
> If I find an error when I do the initial check in the controller (see
history),
> can I forward to an error page directly from the init() method?  Is there
a way
> to do this elegantly?
>
> Thanks,
>
> Dave
>
>
>
>
>
>
> "Craig R. McClanahan" <[EMAIL PROTECTED]> on
03/26/2001
> 01:04:33 PM
>
> Please respond to [EMAIL PROTECTED]
>
> To:   [EMAIL PROTECTED]
> cc:    (bcc: David Hay/Lex/Lexmark)
> Subject:  Re: Initial security check
>
>
>
>
>
> On Mon, 26 Mar 2001 [EMAIL PROTECTED] wrote:
>
> >
> >
> > Craig,
> >
> > Thanks for the reply.  Again, I'm not sure I explained too well.
Whether I
> > require users to login is determined *once* - when the application first
> starts,
> > depending on the underlying connected server.  If they are required,
whoever
> > uses the app once it is up and running will have to log in.  If not,
they will
> > have free access.  So...what I am intending the controller init() method
do,
> is
> > make this check *once*, and set a parameter that persists which
indicates this
> > fact.  I can then check this parameter, rather than making calls to the
> > connected server everytime.
> >
>
> OK, the determination itself definitely makes sense to do at
> init() time.  You would want to store the result of this determination in
> some sort of servlet context attribute, so that it was visible to the
> controller servlet and to your pages (as an application scope bean).
>
> Two different approaches are feasible:
> * Subclass ActionServlet and make the init() method a little smarter
> * Write your own servlet that is also <load-on-startup>, and have it
>   set up this servlet context attribute.  The example app does this
>   with it's "pseudo-database".
>
> > So...I think that this is correct usage for the controller - but please
> correct
> > me if I'm wrong!
> >
> > Dave
> >
>
> Craig
>
>
>
>
>
>
>


Reply via email to