This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes forward to another action Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "forward to another action" Watch "forward to another action" New topic
Author

forward to another action

Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi,

I have defined an action in struts-config.xml as

<action path="/city/introduction"
forward="/GDCityDetail.do?methodToCall=displayCityIntroduction">
</action>

now I need to forward a request to the above action, in another action. is it possible to do it ? if yes pls. inform.

I have tried with the following way.. but it is giving me 404 error.

<action path="/GDBrands"
type="com.ihg.dec.components.goDiscover.struts.actions.GDHomeDispatchAction"
parameter="methodToCall"
scope="session">
<forward name="showCityIntroduction" path="/city/introduction"/>
<forward name="failure" path="ErrorView"/>
</action>

Thanks,
Neeraj
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26184
    
  66

Neeraj,
The action you are trying to forward to doesn't have an Action class defined. So why can't you directly forward to DCityDetail.do?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Change

<forward name="showCityIntroduction" path="/city/introduction"/>

to

<forward name="showCityIntroduction" path="/city/introduction.do"/>

This seems like kind of a round-about way of doing things, though. Why not just define a global forward?

<global-forwards>
<forward name="showCityIntroduction" path="/GDCityDetail.do?methodToCall=displayCityIntroduction" />
</global-forwards>

You could then use this forward from any action.
[ June 26, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi,

Thanks for yuor inputs. i got it working by using

<forward name="showCityIntroduction" path="/city/introduction.do"/>

I had an action mapping, which I forgot to paste..
<action path="/GDCityDetail"
type="com.ihg.dec.components.goDiscover.struts.actions.GDCityDispatchAction"
parameter="methodToCall" name="gdCityContentForm"
scope="session">
<forward name="showCityIntroduction" path="GDCityIntroductionView"/>
<forward name="showCityHotels" path="GDCityHotelsView"/
</action>

Thanks,
Neeraj
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forward to another action
 
Similar Threads
Urgent! Action and forms
Problem with having identical field names across form beans
pageContext.request.
Getting Bad Request
Not able to Call The Action class