You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2003/01/31 00:29:45 UTC

one desing question, need help

Hi,

I want to write 2 classes , one class say MyAction
extends Action and the other class say
MyDispatchAction extends DispatchAction.
I want to have some code ( like setting some
parameters or getting connection from pool) handled in
both the classes, but i want to write it in such a way
that i dont have to code all the common methods in
both classes.
I dont want to have one class which extends
DispatchAction, because DispatchAction needs parameter
as required field in struts-config file.

This way i would be reducing my coding  and future
maintenance, since if there is any modification i can
do it at only one place and will be applicable to both
places

Any suggestions are welcome







=====
A$HI$H

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: one desing question, need help

Posted by Jacob Hookom <ho...@uwec.edu>.
Very true John.  I think the dependency in the decision is at what layer in
his application these responsibilities belong to.  If it's business logic,
then yes, do a Util class for your business logic, but if it's what I would
call a "means" or a utility for your presentation layer or struts code, then
do a filter-- like getting a connection.



| -----Original Message-----
| From: John Espey [mailto:jespey@tallan.com]
| Sent: Thursday, January 30, 2003 5:51 PM
| To: Struts Users Mailing List
| Subject: RE: one desing question, need help
| 
| indeed, filters do rock.  The only thing I would consider is that you're
| going to lose type safety, and you're going to be using either the request
| or the session as the pipe between the filter and the action.  This may
| not
| be a bad thing, but consider which of these you'd rather see:
| 
| Connection conn = (Connection)request.getAttribute("Connection");
| 
| 
| or
| 
| Connection conn = MyUtil.getConnection(connProperties);
| 
| I think either one is acceptable personally, but the intent of the util
| class is more easily apparent.  (The dependency is self documenting,
| whereas
| with the filter it isn't necessarily as easy to know from where the
| connection comes)
| 
| 
| 
| 
| 
| -----Original Message-----
| From: Jacob Hookom [mailto:hookomjj@uwec.edu]
| Sent: Thursday, January 30, 2003 5:42 PM
| To: 'Struts Users Mailing List'
| Subject: RE: one desing question, need help
| 
| 
| Or, you could do a filter that would setup the connection and properties
| in
| the request to these actions, then after they are done, return the
| connection or close it, and essentially clean up whatever you created.
| 
| "Filters Rock!"
| 	- Area Culligan man
| 
| | -----Original Message-----
| | From: John Espey [mailto:jespey@tallan.com]
| | Sent: Thursday, January 30, 2003 5:35 PM
| | To: Struts Users Mailing List
| | Subject: RE: one desing question, need help
| |
| | Just write a singleton class with  methods that take the appropriate
| | parameters, and have both actions delegate to that class.  Then any
| other
| | classes can use those services also.
| |
| | -----Original Message-----
| | From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
| | Sent: Thursday, January 30, 2003 5:30 PM
| | To: struts-user@jakarta.apache.org
| | Subject: one desing question, need help
| |
| |
| | Hi,
| |
| | I want to write 2 classes , one class say MyAction
| | extends Action and the other class say
| | MyDispatchAction extends DispatchAction.
| | I want to have some code ( like setting some
| | parameters or getting connection from pool) handled in
| | both the classes, but i want to write it in such a way
| | that i dont have to code all the common methods in
| | both classes.
| | I dont want to have one class which extends
| | DispatchAction, because DispatchAction needs parameter
| | as required field in struts-config file.
| |
| | This way i would be reducing my coding  and future
| | maintenance, since if there is any modification i can
| | do it at only one place and will be applicable to both
| | places
| |
| | Any suggestions are welcome
| |
| |
| |
| |
| |
| |
| |
| | =====
| | A$HI$H
| |
| | __________________________________________________
| | Do you Yahoo!?
| | Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
| | http://mailplus.yahoo.com
| |
| | ---------------------------------------------------------------------
| | To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| | For additional commands, e-mail: struts-user-help@jakarta.apache.org
| |
| |
| | ---------------------------------------------------------------------
| | To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| | For additional commands, e-mail: struts-user-help@jakarta.apache.org
| 
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
| 
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: one desing question, need help

Posted by Jacob Hookom <ho...@uwec.edu>.
People use filters for exactly what you are describing-- security and
validation.

| -----Original Message-----
| From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
| Sent: Thursday, January 30, 2003 6:11 PM
| To: Struts Users Mailing List
| Subject: RE: one desing question, need help
| 
| Hi,
| What i have to do is the following,
| I have to check if the session is valid or not, if the
| user has logged, has valid user name or not...
| And all this info isstored in the session,
| so i have to send session to check this values
| I dont want to use a single ton pattern because, Then
| there will be only one instance, but then the session
| will be different for each user, and then i cannot use
| singleton, also then i will have to write all the
| methods synchronized which will affect the
| performance..
| There is no issue with connection pooling...as i have
| every thing setup for it, and only have to access it,
| but then i have some parameter in seesion depending on
| which will get connection from different pools
| 
| so what else can u think of
| --- John Espey <je...@tallan.com> wrote:
| > indeed, filters do rock.  The only thing I would
| > consider is that you're
| > going to lose type safety, and you're going to be
| > using either the request
| > or the session as the pipe between the filter and
| > the action.  This may not
| > be a bad thing, but consider which of these you'd
| > rather see:
| >
| > Connection conn =
| > (Connection)request.getAttribute("Connection");
| >
| >
| > or
| >
| > Connection conn =
| > MyUtil.getConnection(connProperties);
| >
| > I think either one is acceptable personally, but the
| > intent of the util
| > class is more easily apparent.  (The dependency is
| > self documenting, whereas
| > with the filter it isn't necessarily as easy to know
| > from where the
| > connection comes)
| >
| >
| >
| >
| >
| > -----Original Message-----
| > From: Jacob Hookom [mailto:hookomjj@uwec.edu]
| > Sent: Thursday, January 30, 2003 5:42 PM
| > To: 'Struts Users Mailing List'
| > Subject: RE: one desing question, need help
| >
| >
| > Or, you could do a filter that would setup the
| > connection and properties in
| > the request to these actions, then after they are
| > done, return the
| > connection or close it, and essentially clean up
| > whatever you created.
| >
| > "Filters Rock!"
| > 	- Area Culligan man
| >
| > | -----Original Message-----
| > | From: John Espey [mailto:jespey@tallan.com]
| > | Sent: Thursday, January 30, 2003 5:35 PM
| > | To: Struts Users Mailing List
| > | Subject: RE: one desing question, need help
| > |
| > | Just write a singleton class with  methods that
| > take the appropriate
| > | parameters, and have both actions delegate to that
| > class.  Then any other
| > | classes can use those services also.
| > |
| > | -----Original Message-----
| > | From: Ashish Kulkarni
| > [mailto:kulkarni_ash1312@yahoo.com]
| > | Sent: Thursday, January 30, 2003 5:30 PM
| > | To: struts-user@jakarta.apache.org
| > | Subject: one desing question, need help
| > |
| > |
| > | Hi,
| > |
| > | I want to write 2 classes , one class say MyAction
| > | extends Action and the other class say
| > | MyDispatchAction extends DispatchAction.
| > | I want to have some code ( like setting some
| > | parameters or getting connection from pool)
| > handled in
| > | both the classes, but i want to write it in such a
| > way
| > | that i dont have to code all the common methods in
| > | both classes.
| > | I dont want to have one class which extends
| > | DispatchAction, because DispatchAction needs
| > parameter
| > | as required field in struts-config file.
| > |
| > | This way i would be reducing my coding  and future
| > | maintenance, since if there is any modification i
| > can
| > | do it at only one place and will be applicable to
| > both
| > | places
| > |
| > | Any suggestions are welcome
| > |
| > |
| > |
| > |
| > |
| > |
| > |
| > | =====
| > | A$HI$H
| > |
| > | __________________________________________________
| > | Do you Yahoo!?
| > | Yahoo! Mail Plus - Powerful. Affordable. Sign up
| > now.
| > | http://mailplus.yahoo.com
| > |
| > |
| >
| ---------------------------------------------------------------------
| > | To unsubscribe, e-mail:
| > struts-user-unsubscribe@jakarta.apache.org
| > | For additional commands, e-mail:
| > struts-user-help@jakarta.apache.org
| > |
| > |
| > |
| >
| ---------------------------------------------------------------------
| > | To unsubscribe, e-mail:
| > struts-user-unsubscribe@jakarta.apache.org
| > | For additional commands, e-mail:
| > struts-user-help@jakarta.apache.org
| >
| >
| >
| ---------------------------------------------------------------------
| > To unsubscribe, e-mail:
| > struts-user-unsubscribe@jakarta.apache.org
| > For additional commands, e-mail:
| > struts-user-help@jakarta.apache.org
| >
| >
| >
| ---------------------------------------------------------------------
| > To unsubscribe, e-mail:
| > struts-user-unsubscribe@jakarta.apache.org
| > For additional commands, e-mail:
| > struts-user-help@jakarta.apache.org
| >
| 
| 
| =====
| A$HI$H
| 
| __________________________________________________
| Do you Yahoo!?
| Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
| http://mailplus.yahoo.com
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: one desing question, need help

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi, 
What i have to do is the following, 
I have to check if the session is valid or not, if the
user has logged, has valid user name or not...
And all this info isstored in the session, 
so i have to send session to check this values
I dont want to use a single ton pattern because, Then
there will be only one instance, but then the session
will be different for each user, and then i cannot use
singleton, also then i will have to write all the
methods synchronized which will affect the
performance..
There is no issue with connection pooling...as i have
every thing setup for it, and only have to access it,
but then i have some parameter in seesion depending on
which will get connection from different pools

so what else can u think of 
--- John Espey <je...@tallan.com> wrote:
> indeed, filters do rock.  The only thing I would
> consider is that you're
> going to lose type safety, and you're going to be
> using either the request
> or the session as the pipe between the filter and
> the action.  This may not
> be a bad thing, but consider which of these you'd
> rather see:
> 
> Connection conn =
> (Connection)request.getAttribute("Connection");
> 
> 
> or
> 
> Connection conn =
> MyUtil.getConnection(connProperties);
> 
> I think either one is acceptable personally, but the
> intent of the util
> class is more easily apparent.  (The dependency is
> self documenting, whereas
> with the filter it isn't necessarily as easy to know
> from where the
> connection comes)
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Jacob Hookom [mailto:hookomjj@uwec.edu]
> Sent: Thursday, January 30, 2003 5:42 PM
> To: 'Struts Users Mailing List'
> Subject: RE: one desing question, need help
> 
> 
> Or, you could do a filter that would setup the
> connection and properties in
> the request to these actions, then after they are
> done, return the
> connection or close it, and essentially clean up
> whatever you created.
> 
> "Filters Rock!"
> 	- Area Culligan man
> 
> | -----Original Message-----
> | From: John Espey [mailto:jespey@tallan.com]
> | Sent: Thursday, January 30, 2003 5:35 PM
> | To: Struts Users Mailing List
> | Subject: RE: one desing question, need help
> |
> | Just write a singleton class with  methods that
> take the appropriate
> | parameters, and have both actions delegate to that
> class.  Then any other
> | classes can use those services also.
> |
> | -----Original Message-----
> | From: Ashish Kulkarni
> [mailto:kulkarni_ash1312@yahoo.com]
> | Sent: Thursday, January 30, 2003 5:30 PM
> | To: struts-user@jakarta.apache.org
> | Subject: one desing question, need help
> |
> |
> | Hi,
> |
> | I want to write 2 classes , one class say MyAction
> | extends Action and the other class say
> | MyDispatchAction extends DispatchAction.
> | I want to have some code ( like setting some
> | parameters or getting connection from pool)
> handled in
> | both the classes, but i want to write it in such a
> way
> | that i dont have to code all the common methods in
> | both classes.
> | I dont want to have one class which extends
> | DispatchAction, because DispatchAction needs
> parameter
> | as required field in struts-config file.
> |
> | This way i would be reducing my coding  and future
> | maintenance, since if there is any modification i
> can
> | do it at only one place and will be applicable to
> both
> | places
> |
> | Any suggestions are welcome
> |
> |
> |
> |
> |
> |
> |
> | =====
> | A$HI$H
> |
> | __________________________________________________
> | Do you Yahoo!?
> | Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> | http://mailplus.yahoo.com
> |
> |
>
---------------------------------------------------------------------
> | To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> | For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> |
> |
> |
>
---------------------------------------------------------------------
> | To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> | For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


=====
A$HI$H

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: one desing question, need help

Posted by John Espey <je...@tallan.com>.
indeed, filters do rock.  The only thing I would consider is that you're
going to lose type safety, and you're going to be using either the request
or the session as the pipe between the filter and the action.  This may not
be a bad thing, but consider which of these you'd rather see:

Connection conn = (Connection)request.getAttribute("Connection");


or

Connection conn = MyUtil.getConnection(connProperties);

I think either one is acceptable personally, but the intent of the util
class is more easily apparent.  (The dependency is self documenting, whereas
with the filter it isn't necessarily as easy to know from where the
connection comes)





-----Original Message-----
From: Jacob Hookom [mailto:hookomjj@uwec.edu]
Sent: Thursday, January 30, 2003 5:42 PM
To: 'Struts Users Mailing List'
Subject: RE: one desing question, need help


Or, you could do a filter that would setup the connection and properties in
the request to these actions, then after they are done, return the
connection or close it, and essentially clean up whatever you created.

"Filters Rock!"
	- Area Culligan man

| -----Original Message-----
| From: John Espey [mailto:jespey@tallan.com]
| Sent: Thursday, January 30, 2003 5:35 PM
| To: Struts Users Mailing List
| Subject: RE: one desing question, need help
|
| Just write a singleton class with  methods that take the appropriate
| parameters, and have both actions delegate to that class.  Then any other
| classes can use those services also.
|
| -----Original Message-----
| From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
| Sent: Thursday, January 30, 2003 5:30 PM
| To: struts-user@jakarta.apache.org
| Subject: one desing question, need help
|
|
| Hi,
|
| I want to write 2 classes , one class say MyAction
| extends Action and the other class say
| MyDispatchAction extends DispatchAction.
| I want to have some code ( like setting some
| parameters or getting connection from pool) handled in
| both the classes, but i want to write it in such a way
| that i dont have to code all the common methods in
| both classes.
| I dont want to have one class which extends
| DispatchAction, because DispatchAction needs parameter
| as required field in struts-config file.
|
| This way i would be reducing my coding  and future
| maintenance, since if there is any modification i can
| do it at only one place and will be applicable to both
| places
|
| Any suggestions are welcome
|
|
|
|
|
|
|
| =====
| A$HI$H
|
| __________________________________________________
| Do you Yahoo!?
| Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
| http://mailplus.yahoo.com
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: one desing question, need help

Posted by Jacob Hookom <ho...@uwec.edu>.
Or, you could do a filter that would setup the connection and properties in
the request to these actions, then after they are done, return the
connection or close it, and essentially clean up whatever you created.

"Filters Rock!"
	- Area Culligan man

| -----Original Message-----
| From: John Espey [mailto:jespey@tallan.com]
| Sent: Thursday, January 30, 2003 5:35 PM
| To: Struts Users Mailing List
| Subject: RE: one desing question, need help
| 
| Just write a singleton class with  methods that take the appropriate
| parameters, and have both actions delegate to that class.  Then any other
| classes can use those services also.
| 
| -----Original Message-----
| From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
| Sent: Thursday, January 30, 2003 5:30 PM
| To: struts-user@jakarta.apache.org
| Subject: one desing question, need help
| 
| 
| Hi,
| 
| I want to write 2 classes , one class say MyAction
| extends Action and the other class say
| MyDispatchAction extends DispatchAction.
| I want to have some code ( like setting some
| parameters or getting connection from pool) handled in
| both the classes, but i want to write it in such a way
| that i dont have to code all the common methods in
| both classes.
| I dont want to have one class which extends
| DispatchAction, because DispatchAction needs parameter
| as required field in struts-config file.
| 
| This way i would be reducing my coding  and future
| maintenance, since if there is any modification i can
| do it at only one place and will be applicable to both
| places
| 
| Any suggestions are welcome
| 
| 
| 
| 
| 
| 
| 
| =====
| A$HI$H
| 
| __________________________________________________
| Do you Yahoo!?
| Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
| http://mailplus.yahoo.com
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org
| 
| 
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: one desing question, need help

Posted by John Espey <je...@tallan.com>.
Just write a singleton class with  methods that take the appropriate
parameters, and have both actions delegate to that class.  Then any other
classes can use those services also.

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
Sent: Thursday, January 30, 2003 5:30 PM
To: struts-user@jakarta.apache.org
Subject: one desing question, need help


Hi,

I want to write 2 classes , one class say MyAction
extends Action and the other class say
MyDispatchAction extends DispatchAction.
I want to have some code ( like setting some
parameters or getting connection from pool) handled in
both the classes, but i want to write it in such a way
that i dont have to code all the common methods in
both classes.
I dont want to have one class which extends
DispatchAction, because DispatchAction needs parameter
as required field in struts-config file.

This way i would be reducing my coding  and future
maintenance, since if there is any modification i can
do it at only one place and will be applicable to both
places

Any suggestions are welcome







=====
A$HI$H

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: one desing question, need help

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi,
Thnx for all the mails, where can i get some example
of using filters?? 
can u please recommend some web sites...
where i can get info
Ashish
--- Andrew Hill <an...@gridnode.com>
wrote:
> Shared utility class is probably your best bet.
> 
> In my app, I actually created my own dispatch action
> class that extended my
> base Action class (by cutting and pasting the struts
> dispatch action source
> into my own class changing the
> 'extends'declaration), though this has
> various drawbacks, the most notable of which being
> that you would need to
> update the code in this class if you changed the
> version of struts you were
> using. Id recommend you go with the static utility
> class, though as other
> posters mentioned, certain things are better suited
> to filters, so you do
> have a couple of options to look at.
> 
> -----Original Message-----
> From: Ashish Kulkarni
> [mailto:kulkarni_ash1312@yahoo.com]
> Sent: Friday, 31 January 2003 07:30
> To: struts-user@jakarta.apache.org
> Subject: one desing question, need help
> 
> 
> Hi,
> 
> I want to write 2 classes , one class say MyAction
> extends Action and the other class say
> MyDispatchAction extends DispatchAction.
> I want to have some code ( like setting some
> parameters or getting connection from pool) handled
> in
> both the classes, but i want to write it in such a
> way
> that i dont have to code all the common methods in
> both classes.
> I dont want to have one class which extends
> DispatchAction, because DispatchAction needs
> parameter
> as required field in struts-config file.
> 
> This way i would be reducing my coding  and future
> maintenance, since if there is any modification i
> can
> do it at only one place and will be applicable to
> both
> places
> 
> Any suggestions are welcome
> 
> 
> 
> 
> 
> 
> 
> =====
> A$HI$H
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> http://mailplus.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


=====
A$HI$H

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: one desing question, need help

Posted by Andrew Hill <an...@gridnode.com>.
Shared utility class is probably your best bet.

In my app, I actually created my own dispatch action class that extended my
base Action class (by cutting and pasting the struts dispatch action source
into my own class changing the 'extends'declaration), though this has
various drawbacks, the most notable of which being that you would need to
update the code in this class if you changed the version of struts you were
using. Id recommend you go with the static utility class, though as other
posters mentioned, certain things are better suited to filters, so you do
have a couple of options to look at.

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
Sent: Friday, 31 January 2003 07:30
To: struts-user@jakarta.apache.org
Subject: one desing question, need help


Hi,

I want to write 2 classes , one class say MyAction
extends Action and the other class say
MyDispatchAction extends DispatchAction.
I want to have some code ( like setting some
parameters or getting connection from pool) handled in
both the classes, but i want to write it in such a way
that i dont have to code all the common methods in
both classes.
I dont want to have one class which extends
DispatchAction, because DispatchAction needs parameter
as required field in struts-config file.

This way i would be reducing my coding  and future
maintenance, since if there is any modification i can
do it at only one place and will be applicable to both
places

Any suggestions are welcome







=====
A$HI$H

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org