I'm considering doing something, and I'm trying to decide if it's safe to do. 
I'm sure this particular battle has been fought before. I'm curious what the 
results are from those who have waged it.

A typical case: At the beginning of your action, you want to get the current 
user's record from the database. Say the user id itself is stored in the 
httpSession.

In fact, so typical is this case, it would make sense to have this always 
happen at the beginning of the Action. 

My first instinct was to declare an execute() method in my base Action class, 
get the current user's User object based upon the user id, and then do a 
super.execute().

Problem is, there's no way to pass in the user object I got got into 
super.execute.

So my options appear to be either 1) Call getUser() at the beginning of every 
Action method, or 2) In the base class' execute() method, call getUser() and 
store the User object in a static ThreadLocal like one of the example 
Hibernate plugins does with the Hibernate Session object.

Is there any good reason not to do the latter (like, fer instance, "Um, it 
won't work, Joe")???

Anyway, it just seems like the base class' execute() method would be a good 
place to call pre-"guts" and post-"guts" Action code. Is this the way to go 
about it, or is there a better one?

TIA,

-Joe

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

Reply via email to