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

struts-config.xml file problem

 
Shashidahanu Iyyanar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic