For a new app, the simplest solution is an abstract subclass of Action which all of your classes extend; your subclass implements execute, where you put your per-request logic, and then calls another (abstract) method like 'doExecute", which is implemented in your concrete classes. The biggest problem with this solution is that you "blow" your one chance at Java inheritance, so if you want to use a variety of superclasses, you have a lot of overhead. But it's conceptually pretty simple and good for many cases.
In your case, since you've already written a lot of code, you may want to go straight to the more sophisticated solution, which would involve subclassing RequestProcessor (or TilesRequestProcessor) and override "processPreprocess" or "processRoles". Assuming that you can implement the logic you need with whatever values are passed in to those methods, this provides a pretty straightforward way to do things.
Of course, in Struts 1.3, the ComposableRequestProcessor makes this even easier.
Joe
At 1:48 PM -0500 5/17/05, Lee Harrington wrote:
I want to check to see if the user is logged in before performing any action, and redirect to the login page if they are not.
For example...they have a page open and their session times out....and then they click a button. Right now an error occurs because they are no longer logged in.
I wrote a bit of code that if I put it in the beggining of an action class...does just that. But I don't want to have to put this in the front of each of my actions (particularly since I've already written a good portion of the app).
Do I solve this by subclassing the action forward -- or in some other way?
Lee
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]