• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

struts-config.xml file problem

 
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.
 
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
 
Seriously? That's what you're going with? I prefer this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic