wood burning stoves 2.0*
The moose likes Struts and the fly likes How to forward to Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to forward to Action class" Watch "How to forward to Action class" New topic
Author

How to forward to Action class

surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
hi

I have a jsp which makes request to an Action class Action1.

Action1 get all request parameters, say form parameters , updates the database and then it should forward the control to another Action Action2 or an jsp.

The forward to jsp is working fine.

but for the forward to Action2 gives an error, resource with path /action2 is not available.

my mapping is
return mapping.findForward("action2");

my struts-config.xml is

< action path="/action1" type="Action1" name="myForm">
< forward name="myjsp1" path="/myjsp1" /> --> no problem here..

< forward name="action2" path="/action2" /> --> here i have problem..
< /action>

< action path="/action2" type="Action2" name="myForm" >
< forward name="something" path="something" />
< /action>


SCJP 1.4
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Change the following line

< forward name="action2" path="/action2" />

to

< forward name="action2" path="/action2.do" />

Remember, this is a URL so it has to have the ".do" suffix.

This link explains more about action chaining.


Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to forward to Action class