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