RE: executing statements on subsets of actions without code duplication

2003-06-16 Thread shirishchandra.sakhare
What is inheritancde for then:-))

Make an abstract action and have this code there...
 All your actions will extend this action..And bingo here you go.

-Original Message-
From: Rob [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 14, 2003 6:34 AM
To: Struts Users Mailing List
Subject: executing statements on subsets of actions without code
duplication


I have a set of statements I would like executed every time
an action is executed.  I would also like to only have to
code these set of statements once and have them transparently
executed for all actions (except for a small subset).

Is there a facility in struts for doing this?  Is there an
example somewhere perhaps in the example application?
(I couldn't see one)

Thanks


-
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]



Re: executing statements on subsets of actions without code duplication

2003-06-15 Thread Rob Leland
Rob wrote:

Rob Leland wrote:

Rob wrote:

I have a set of statements I would like executed every time
an action is executed.  I would also like to only have to
code these set of statements once and have them transparently
executed for all actions (except for a small subset). 


When we were using a Servlet 2.2 container we derived a class
from Action named SecureAction, which checked that the user was 
logged in.

Can you explain how this was done in a little more detail, particularly
what methods were used, where they were used etc..?  I have the current
arrangement where I extend Action with a BaseAction, which implements
my common method (the one to be called always) and then from subclasses
of BaseAction.execute() I call the common method. 


Find out what method in Action calls the execute() method, which is empty.
I forget. Override that method in BaseAction, then place a call to your
common method in that method. That way no Action can be called unless
your common method says it can.
-Rob



It is this having to manually call the common method I would like to
eliminate and just have it transparently occur higher in the
hierarchy.
As for your suggestion of using filters could you direct me to more
information regarding that method I'm interested in exploring it.
Thanks

Then all the applications Actions would be SecureAction Children.

If struts had events then the event could be hooked instead, this is 
easy enough to do.

Under Servlet 2.3 filters could be used.

-Rob



-
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]


Re: executing statements on subsets of actions without code duplication

2003-06-14 Thread Rob Leland
Rob wrote:

I have a set of statements I would like executed every time
an action is executed.  I would also like to only have to
code these set of statements once and have them transparently
executed for all actions (except for a small subset). 
When we were using a Servlet 2.2 container we derived a class
from Action named SecureAction, which checked that the user was logged in.
Then all the applications Actions would be SecureAction Children.

If struts had events then the event could be hooked instead, this is 
easy enough to do.

Under Servlet 2.3 filters could be used.

-Rob



Is there a facility in struts for doing this?  Is there an
example somewhere perhaps in the example application?
(I couldn't see one)
Thanks

-
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]


Re: executing statements on subsets of actions without code duplication

2003-06-14 Thread Rob
Rob Leland wrote:
Rob wrote:

I have a set of statements I would like executed every time
an action is executed.  I would also like to only have to
code these set of statements once and have them transparently
executed for all actions (except for a small subset). 


When we were using a Servlet 2.2 container we derived a class
from Action named SecureAction, which checked that the user was logged in.
Can you explain how this was done in a little more detail, particularly
what methods were used, where they were used etc..?  I have the current
arrangement where I extend Action with a BaseAction, which implements
my common method (the one to be called always) and then from subclasses
of BaseAction.execute() I call the common method.
It is this having to manually call the common method I would like to
eliminate and just have it transparently occur higher in the
hierarchy.
As for your suggestion of using filters could you direct me to more
information regarding that method I'm interested in exploring it.
Thanks

Then all the applications Actions would be SecureAction Children.

If struts had events then the event could be hooked instead, this is 
easy enough to do.

Under Servlet 2.3 filters could be used.

-Rob



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


executing statements on subsets of actions without code duplication

2003-06-13 Thread Rob
I have a set of statements I would like executed every time
an action is executed.  I would also like to only have to
code these set of statements once and have them transparently
executed for all actions (except for a small subset).
Is there a facility in struts for doing this?  Is there an
example somewhere perhaps in the example application?
(I couldn't see one)
Thanks

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