You can achieve this using the subclass support in struts-config.xml.
Create your custom ActionForward class and provide it with your property:
public class CustomActionForward
extends ActionForward {
private int returnCode = 0;
public int getReturnCode() { return returnCode; }
public void setReturnCode(int returnCode) { this.returnCode = returnCode; }
}
Use the className attribute to specify your custom class, and use
<set-property> to configure it:
<action path="/somePath"
type="my.package.SomeAction">
<forward name="success" path="/somePage.jsp"
className="my.package.CustomActionForward">
<set-property property="returnCode" value="10"/>
</forward>
</action>
Then in your SomeAction:
ActionForward forward = mapping.findForward("success");
if (forward instanceof CustomActionForward) {
returnCode = ((CustomActionForward) forward).getReturnCode();
System.out.println("returnCode = " + returnCode);
}
// do whatever with your return code
...
return forward;
hth,
Hubert
On Mon, 28 Feb 2005 13:02:51 +0100, Subcontrato Online2
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> I need to add a new attribute "resultcode" in the action-mapping <forward>
> tag. Example:
> <forward contextRelative="true" name="invalidNews"
> path="/WEB-INF/jsp/fsMarcos.jsp" resultcode="01"/>
>
> This attribute will define a result code for the action the user requested.
>
> I'm thinking in extending the ActionMapping,ActionForward classes and
> implement this features.
>
> Does anyone tried this?
> Any other idea?
>
> Thanks a lot.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]