<action name="HomeUpdate"
class="com.lwl.action.update.pub.HomeUpdateAction">
<result name="success"
type="chain">
<param
name="actionName">Home</param>
</result>
<interceptor-ref
name="echo">
<param name="name">update
session</param>
</interceptor-ref>
<interceptor-ref
name="echo">
<param name="name">update
transaction</param>
</interceptor-ref>
</action>
<action name="Home"
class="com.lwl.action.view.pub.HomeAction">
<result name="success"
type="dispatcher">
<param
name="location">/WEB-INF/views/pub/Home.jsp</param>
</result>
<interceptor-ref
name="echo">
<param name="name">view
session</param>
</interceptor-ref>
</action>
when calling UpdateHome.action I get :
update session
before
update transaction
before
update
execute
view session
before
view
execute
start jsp
end jsp
view session
after
update transaction after
update session
after
the only way that I can end the transaction before "view execute" woud be in "view session before" and that is a "Bad Idea (tm)"
I can get my actions to manage transactions, but isn't that what containers are for :)
I want to have 'update' actions and 'view' actions, and the update actions run within a transaction container (interceptor) therefore the action implementor only needs to wory about transactions under certain conditions. I can have a default 'commit' policy, with rollback on exception, and if the action wants to commit and throw an exception, a special DoCommitException(Exception) can be thrown, caught , unwrapped and re thrown by the container (interceptor).
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Carreira
Sent: Wednesday, 16 July 2003 4:48 AM
To: [EMAIL PROTECTED]
Subject: RE: [OS-webwork] WebWork2 Action Chains and Interceptors
See below-----Original Message-----
From: Cameron Braid [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 15, 2003 2:35 PM
To: [EMAIL PROTECTED]
Subject: [OS-webwork] WebWork2 Action Chains and InterceptorsI have an action chain that implements a three phase process - Update, Read, RenderI have two actions PhaseOneAction and PhaseTwoAction, and a JSP viewI have two interceptors SessionInterceptor and TransactionInteceptor.I want to achieve one of the following nestingsSessionInterceptor.before()TransactionInterceptor.before()PhaseOneAction.execute()TransactionInterceptor.after()PhaseTwoAction.execute();SessionInterceptor.after()You could achieve this by making your Interceptors a little crafty... The SessionInterceptor is already in place... you just need to parameterize your TransactionInterceptor as to whether to process on before, after, or both. Then, on the first action, you have it process before, and on the second, you have it process on after. I think this is probably not a Good Thing (tm), since it depends on the chaining, but it would work. Alternately, you could have the TransactionInterceptor, in the after call, look for the Transaction in the ActionContext or request, or wherever and use it if it's there or skip processing if it's not, then remove it once it's done. A little less hacky. Can't you just have your Action class itself handle the transaction in the execute()?orSessionInterceptor.before()TransactionInterceptor.before()PhaseOneAction.execute()TransactionInterceptor.after()SessionInterceptor.after(){note: I don't want a client redirect here}SessionInterceptor.before()PhaseTwoAction.execute();ServletDispatcher.processPage();SessionInterceptor.after()however, currently I am only able to achieveSessionInterceptor.before()TransactionInterceptor.before()PhaseOneAction.execute()PhaseTwoAction.execute();ServletDispatcher.processPage();TransactionInterceptor.after()SessionInterceptor.after()I also would like to be able to specify that the action state is coppied from PhaseOneAction to PhaseTwoAction in the same way that the chaining process currently happens.Anyone have any ideas ?Cameron.