You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jerry Jalenak <Je...@LABONE.com> on 2003/06/09 20:18:37 UTC

Subclassing ActionMapping

This should be so stinkin' obvious that I ought to be seeing it, but after
spending all morning trying to figure this out, I hope someone can shed some
light for me.  I've subclassed ActionMapping so I can include a couple of
<set-property> tags in my Actions.  This seems to work OK as I can see the
'setters' being called when the web app initializes.  The question I have is
this - which class do I specify for my execute action?  Do I use the
standard method signature of

	public ActionForward execute(ActionMapping am, ActionForm af,
HttpServletRequest req, HttpServletResponse res)

or do I use my subclass?

	public ActionForward execute(myActionMapping am, ActionForm af,
HttpServletRequest req, HttpServletResponse res)

I've tried both.  When I use the normal signature, I can't see my custom
attributes.  If I specify my subclassed ActionMapping class
(myActionMapping), nothing seems to work (i.e. can't forward to anything,
action never actually gets invoked).  In my struts-config I specify my
subclassed ActionMapping class using the className attribute on the <action>
tag.

Arrgh.  This shouldn't be this tough, but I just can't see it.


Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

jerry.jalenak@labone.com


This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: securityincidentreporting@labone.com



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


Re: Subclassing ActionMapping

Posted by José Ventura <ve...@cit.com.br>.
I'm just guessing here, but have you tried using the
first signature (using the "normal" ActionMapping) and
then casting it inside your action to "myActionMapping"?

HTH
- v

----- Original Message -----
From: "Jerry Jalenak" <Je...@LABONE.com>
To: <st...@jakarta.apache.org>
Sent: Monday, June 09, 2003 3:18 PM
Subject: Subclassing ActionMapping


> This should be so stinkin' obvious that I ought to be seeing it, but after
> spending all morning trying to figure this out, I hope someone can shed
some
> light for me.  I've subclassed ActionMapping so I can include a couple of
> <set-property> tags in my Actions.  This seems to work OK as I can see the
> 'setters' being called when the web app initializes.  The question I have
is
> this - which class do I specify for my execute action?  Do I use the
> standard method signature of
>
> public ActionForward execute(ActionMapping am, ActionForm af,
> HttpServletRequest req, HttpServletResponse res)
>
> or do I use my subclass?
>
> public ActionForward execute(myActionMapping am, ActionForm af,
> HttpServletRequest req, HttpServletResponse res)
>
> I've tried both.  When I use the normal signature, I can't see my custom
> attributes.  If I specify my subclassed ActionMapping class
> (myActionMapping), nothing seems to work (i.e. can't forward to anything,
> action never actually gets invoked).  In my struts-config I specify my
> subclassed ActionMapping class using the className attribute on the
<action>
> tag.
>
> Arrgh.  This shouldn't be this tough, but I just can't see it.
>
>
> Jerry Jalenak
> Team Lead, Web Publishing
> LabOne, Inc.
> 10101 Renner Blvd.
> Lenexa, KS  66219
> (913) 577-1496
>
> jerry.jalenak@labone.com
>
>
> This transmission (and any information attached to it) may be confidential
and is intended solely for the use of the individual or entity to which it
is addressed. If you are not the intended recipient or the person
responsible for delivering the transmission to the intended recipient, be
advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is
strictly prohibited. If you have received this transmission in error, please
immediately notify LabOne at the following email address:
securityincidentreporting@labone.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: Subclassing ActionMapping

Posted by Mike Jasnowski <mj...@bea.com>.
When you extract the ActionMapping are you casting it to your new subclassed
actionMapping or the parent class?

MyExtension ext = (MyExtension)actionMapping;

Where MyExtension is the class named in the "className" attribute of your
config

HTH,
Mike

-----Original Message-----
From: Jerry Jalenak [mailto:Jerry.Jalenak@LABONE.com]
Sent: Monday, June 09, 2003 2:19 PM
To: 'struts-user@jakarta.apache.org'
Subject: Subclassing ActionMapping


This should be so stinkin' obvious that I ought to be seeing it, but after
spending all morning trying to figure this out, I hope someone can shed some
light for me.  I've subclassed ActionMapping so I can include a couple of
<set-property> tags in my Actions.  This seems to work OK as I can see the
'setters' being called when the web app initializes.  The question I have is
this - which class do I specify for my execute action?  Do I use the
standard method signature of

	public ActionForward execute(ActionMapping am, ActionForm af,
HttpServletRequest req, HttpServletResponse res)

or do I use my subclass?

	public ActionForward execute(myActionMapping am, ActionForm af,
HttpServletRequest req, HttpServletResponse res)

I've tried both.  When I use the normal signature, I can't see my custom
attributes.  If I specify my subclassed ActionMapping class
(myActionMapping), nothing seems to work (i.e. can't forward to anything,
action never actually gets invoked).  In my struts-config I specify my
subclassed ActionMapping class using the className attribute on the <action>
tag.

Arrgh.  This shouldn't be this tough, but I just can't see it.


Jerry Jalenak
Team Lead, Web Publishing
LabOne, Inc.
10101 Renner Blvd.
Lenexa, KS  66219
(913) 577-1496

jerry.jalenak@labone.com


This transmission (and any information attached to it) may be confidential
and is intended solely for the use of the individual or entity to which it
is addressed. If you are not the intended recipient or the person
responsible for delivering the transmission to the intended recipient, be
advised that you have received this transmission in error and that any use,
dissemination, forwarding, printing, or copying of this information is
strictly prohibited. If you have received this transmission in error, please
immediately notify LabOne at the following email address:
securityincidentreporting@labone.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