This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can an action class forward to another action class?

 
Polireddy Vanukuri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My stuts-config.xml is [having 3 action classes mapping information including a form-bean also]...

<struts-config>
<form-beans>
<form-bean type="btch.BatchBillForm" name="batchbillForm"/>
</form-beans>

<action-mappings>
<action type="btch.LoadControlFromDB" validate="false" scope="session" path="/Goto_BBE_Screen" name="batchbillForm">
<forward name="showBatchbill" path="/BatchBillEntry.jsp" />
</action>

<action type="btch.bbEntryAction" scope="session" path="/bbEntryAction" name="batchbillForm">
<forward name="showAddedBatchbill" path="/bbVAction" />
</action>

<action path="/bbVAction" type="btch.BBVAction" scope="session" name="batchbillForm">
<forward name="batchbill" path="/BatchBill.jsp"/>
</action>

</struts-config>


my home page is index.jsp which having an anchor link with hyper link- Goto_BBE_Screen.It is calling LoadControlFromDB action class which is in btch directory. That class after processing execute() forwarding to BatchBillEntry.jsp page with the following action mapping.

<action type="btch.LoadControlFromDB" validate="false" scope="session" path="/Goto_BBE_Screen" name="batchbillForm">
<forward name="showBatchbill" path="/BatchBillEntry.jsp" />
</action>

It is showing the BatchBillEntry.jsp page. It has a form with some fields. Form action path is -- bbEntryAction. It has the following mapping information in struts config file:

<action type="btch.bbEntryAction" scope="session" path="/bbEntryAction" name="batchbillForm">
<forward name="showAddedBatchbill" path="/bbVAction" />
</action>

After processing the 'bbEntryAction' action class, i have to forward the request to another action class 'BBVAction'. Following mapping information i am giving.

path="/bbEntryAction" name="batchbillForm">
<forward name="showAddedBatchbill" path="/bbVAction" />
</action>

Here is the problem i am getting. The error i am getting is..

Error: Requested resource with path=/bbVAction is not available.

All 3 action classes i am having in btch folder. It is calling 2 action classes as i mentioned above in config file. while calling 3rd action class it is giving above error.

What is the reason for this? Is there any need that i have to use global forwards? I tried that also. But same error(resource not available) i am getting.

Is it valid that an action class request forwarded to another action class?
If so,give me the solution for my problem.
Please help me regarding this.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64692
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the Struts forum.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to append the suffix to the action (like .do or whatever you use)
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea...I think the ".do" part is your problem. You may want to search around for information on "Action Chaining". I do not completely understand all the issue involved, but I know that there are issues with chaining multiple actions like you have proposed. If you can get away with adding redirect="true" to your forward, you will probably be better off (plus redirecting updates the URL that the user sees in the browser, eliminating some "user presses the refresh button" issues).

- Brent
 
Polireddy Vanukuri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply.
I tried by suffixing the path with .do in both request and response <action> paths. But I am getting same error again. My application won't show response in same page for every submit action.So here,there is no need of enabling redirect attribute.
I tried whole day with different possibilities(suffixing .do to path,defining a global forward with and without suffixing .do).

Please give me solution for my problem.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where are you adding in ".do"? The only place that should show up is in the path attribute of your forward definition.

- Brent
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic