This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes struts-config.xml file problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts-config.xml file problem" Watch "struts-config.xml file problem" New topic
Author

struts-config.xml file problem

Shashidahanu Iyyanar
Ranch Hand

Joined: Jun 22, 2005
Posts: 37
Hi,
In my project,I have the following scenario.I have a action class whose action forward path should make a call to a method in a dispatch action class.Is this possible in struts?For example,consider the following mapping in struts-config.xml:
<action path="/borrowerOperations" type="com.nucleus.web.app.borrower.actions.BorrowerOperationsAction" parameter="submit">
<forward name="deleteBorrowers" path="/borrowerList.do?method=deleteBorrowers"/>
<forward name="saveBorrowers" path="/borrowerList.do"/>
</action>

In the above example,the forward path named "deleteBorrowers" for the BorrowerOperationsAction class should make a call to the deleteBorrowers method of the dispatch action class represented by the path "/borrowerList.do".
Is this possible?Is the action mapping for the given scenario represented correctly in the struts-config.xml?
Please reply to this as soon as possible.Thanks in advance.
sudhakar Tadepalli
Ranch Hand

Joined: Dec 27, 2001
Posts: 130
Yes. It is possible. You action call must extend DispatchAction class. and pass a parametername ex:method in struts config file.

Ex:<action path="/data" type="....."
name="dataForm" scope="session" parameter="method" validate="false" >
<forward name="list" path="/xyz.jsp" />

</action>

And you need to include method=edit in your URL or submit action and you should have a method name called edit in your action class.

Some usefull inks :
http://www.reumann.net/struts/lesson3/step6.do
http://struts.apache.org/api/org/apache/struts/actions/DispatchAction.html
http://struts.apache.org/api/org/apache/struts/actions/LookupDispatchAction.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts-config.xml file problem
 
Similar Threads
Mapping a main Action Servlet to other servlets
cut&paste changes to DispatchAction fail
Problem in using DispatchAction
a single action a struts application
Urgent Dispatch Action