At 2:55 PM +0100 3/10/06, starki78 wrote:
Yes I also come to the conclusion that it doesn't fit optimally,
but it's always worth making such considerations to come to new solutions!
And speaking of new solutions, it's worth pointing out that in Struts
1.3 you can use the commons-chain API to execute a chain of Commands
instead of or in addition to an action. If you used a chain instead
of an action, you could use the commons-chain Filter interface to
have reusable code operate before and after just the action execution
stage.
Note that the complete chain is executed before the action, so you
couldn't use this around an Action, per se. It wouldn't be that hard
to move your action into a chain by implementing Command, but I'll
spare the details...
And, with WebWork, which is becoming the basis of Struts 2, you can
apply a stack of interceptors on a per-action basis, which is another
way to reuse common code in processing requests.
Joe
Thanks for your input
Starky
---------- Initial Header -----------
From : "Joe Germuska" [EMAIL PROTECTED]
To : "starki78" [EMAIL PROTECTED],"user" user@struts.apache.org
Cc :
Date : Fri, 10 Mar 2006 07:25:33 -0600
Subject : Re: Using Filters with Struts?
At 8:23 AM +0100 3/10/06, starki78 wrote:
>Hi I made thoughts about filters
>(javax.servlet.Filter)
>e.g. use them for logging
>and performance measuring purposes.
>Now as we are using struts I would like
>to know if you can, and if it makes
>sense to assign a filter to an action.
>Can someone help me understand if this might
>be a good solution?
You can certainly use servlet filters with Struts. It would be hard
to apply a filter to a specific action, since the filters operate
before-and-after Struts but not during the execution. I suppose you
might have the filter set a request attribute and then have an Action
look for it, but that seems tangled and suboptimal.
I suppose in the end it depends on what you're trying to do.
Joe
--
Joe Germuska
[EMAIL PROTECTED] * http://blog.germuska.com
"You really can't burn anything out by trying something new, and
even if you can burn it out, it can be fixed. Try something new."
-- Robert Moog
---------------------------------------------------------------------
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]
--
Joe Germuska
[EMAIL PROTECTED] * http://blog.germuska.com
"You really can't burn anything out by trying something new, and
even if you can burn it out, it can be fixed. Try something new."
-- Robert Moog
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]