I'm glad Ed replied because I missed your reply Anil... I wasn't ignoring you :)
Ed covered it well... when I do this, I tend to do it slightly different... I write an Action that has an extra empty method, realExecute()... execute() calls realExecute(), and any "common" code, like your transformation logic, is in execute()... then I extent this class to create the Actions for my application, I override realExecute(), and that's that. Same basic concept, just a slightly different structure. Still saying filter though :) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, December 14, 2006 9:59 am, Ed Griebel wrote: > You would define a base action that extends > org.apache.struts.action.Action and includes a method execute() or > maybe a helper method doSetup(). > > Your action classes would then extend this BaseAction class and then > one of the first things you would do in execute() would be to call > super.execute() or super.doSetup(). > > But, like Frank said, it would be better to decouple your logic from > Struts by implementing a servlet filter which will work regardless if > using struts 1.2, 1.3, 2.0, or just plain old servlets+JSPs. > > HTH, > -ed > > On 12/14/06, Anil Kumar T <[EMAIL PROTECTED]> wrote: >> >> Hi Frank, >> >> Referring to your response.. >> you might also be able >> to have a base Action that all your Actions extend from, and the base >> action does the transformation before the real work happens. This might >> work if you don't need the transformation to happen before that point. >> >> How does this works ? Theoretically I understand this, but how to >> implement this? I mean where do we mention our CustomizedBaseAction >> class name? some where in properties ? Can you tell me..? >> >> Anil. >> >> >> >> -----Original Message----- >> From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] >> Sent: Wednesday, December 13, 2006 1:03 AM >> To: Struts Users Mailing List >> Cc: 'user@struts.apache.org' >> Subject: Re: Preprocessing of request >> >> Your best bet most likely is a servlet filter. Do the transformation >> and >> stuff the transformed content in request as an attribute, then grab it >> later in your Actions. >> >> Which version of Struts are you using? If pre-1.3, modifying the RP is >> one of the few other options as Dave mentioned... you might also be able >> to have a base Action that all your Actions extend from, and the base >> action does the transformation before the real work happens. This might >> work if you don't need the transformation to happen before that point. >> >> If using 1.3.x, you could write a command to do it and modify the RP >> chain. >> >> If 2.x, an interceptor is probably the right answer. >> >> However, in all these cases, a servlet filter would work, and would keep >> your transformation logic abstracted out of Struts itself, so one less >> thing to worry about if you upgrade versions later :) >> >> Frank >> >> >> -- >> Frank W. Zammetti >> Founder and Chief Software Architect >> Omnytex Technologies >> http://www.omnytex.com >> AIM/Yahoo: fzammetti >> MSN: [EMAIL PROTECTED] >> Author of "Practical Ajax Projects With Java Technology" >> (2006, Apress, ISBN 1-59059-695-1) >> Java Web Parts - http://javawebparts.sourceforge.net >> Supplying the wheel, so you don't have to reinvent it! >> >> On Tue, December 12, 2006 1:17 pm, O'Toole, Joe wrote: >> > Hi >> > >> > My application receieves an xml request. I need to perform some >> > transformation of this xml before performing business logic etc. >> > >> > Is there anyway I can configure through struts that I can invoke a >> java >> > class that does this task as I don't want to perform it in the action >> or >> > the >> > model. Something like the plug-in element in the struts-config.xml >> that >> > invokes a java class that adheres to correct interface for performing >> > tasks >> > when the app is starting/stopping. >> > >> > I cannot see where I can do this and I would really to make this task >> > configurable and push it out from the action or model >> > >> > Thanks >> > >> > Joe >> > >> > >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> Information transmitted by this e-mail is proprietary to Infinite >> Computer Solutions and / or its Customers and is intended for use only >> by the individual or the entity to which it is addressed, and may >> contain information that is privileged, confidential or exempt from >> disclosure under applicable law. If you are not the intended recipient >> or it appears that this mail has been forwarded to you without proper >> authority, you are notified that any use or dissemination of this >> information in any manner is strictly prohibited. In such cases, please >> notify us immediately at [EMAIL PROTECTED] and delete this email from >> your records. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]