There's nothing wrong with using a filter, if that works for you.

Within the Struts framework, you can either extend the RequestProcessor or use a base Action.

Extending the RequestProcessor ensures that the task will be performed for each request, but some developers shy away from extending the RequestProcessor.

With a base Action, you are not guaranteed that the task will be performed unless each Action you use extends the base Action. The usual approach is to define your own version of the execute signature and mark it abstract. You then put whatever you need to do each time in the base execute signature and that one call your version when it's ready.

ActionForward myExecute(...) throws ...;

ActionForward execute(...) throws ... {

ActionForward forward = doMyStuff(...);

if (forward!=null) return forward;

return execute(...);

}

For access and authorization checks, a good approach is to use JAAS and the processRoles property of the ActionMapping. Alternatively, you can extend the RequestProcessor to handle your own login code.

HTH, Ted.

lis wrote:
Hello

Where I can perform global tasks for application ?
I mean: some user specific configure tasks for example or check for
user is signin in.

I do it via Filter Servlet now,
but I think exists other method on the MVC framework for this job.

In other words, how I can add some task, which Struts controller will
perform for me for every http request.


-- Ted Husted, Junit in Action - <http://www.manning.com/massol/>, Struts in Action - <http://husted.com/struts/book.html>, JSP Site Design - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.



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



Reply via email to