Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

forward to another action

 
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 39997
807
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
please buy this thing and then I get a fat cut of the action:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic