This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

forwarding between action classes

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a reqmt to forward my request to another class from one action class. I am using struts + tiles. All my action forwards point to some tiles definition. Now if i give an action forward defined to another action forward defined in the struts-cofig, it doesnt seem to accept it, instead i have a strong feeling that it is looking for it in the tiles definitions.

any suggestions on how to go about please !!

Thanks in advance,

Dilish
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts config:
<action path="/MyAction"
name="MyForm"
scope="request"
type="com.whatever.MyActionClass">
<forward name="success" path="/success.jsp"/>
<forward name="chainedAction" path="/ChainedAction.do"/>
</action>
<action path="/ChainedAction"
name="MyForm"
scope="request"
type="com.whatever.MyChainedActionClass">
<forward name="success" path="/chainedSuccess.jsp"/>
</action>

In your MyActionClass:
return mapping.findForward("chainedAction"); // if you want to go to your next action
 
Dilish Kuruppath
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, however, this is exactly what I have done in my code. However, this doesnt seem to work. I am implementing it over a portlet API in Liferay portal server. But as the underlying concept was the same of struts, posted it here. As we are using struts tiles, my code would look like -

<action path="/MyAction"
name="MyForm"
type="com.whatever.MyActionClass">
<forward name="portlet.tiles.url.success" path="portlet.tiles.url.success.definedInTilesdef"/>
<forward name="chainedAction" path="/ChainedAction/edit"/>

<!--
1. we dont have a *.do extension attached, when attached it didnt seem to work,hence added the portlet mode as an extension to the servlet URL as /<servletname>/edit & /<servletname>/view.

2. All the paths are defined in tiles-def.xml which point to the correspdng jsp files.

3. for a forward as defined in the chained action above, I presume that it tries to look into the tiles defs for the URL and not look at it as a new action defined in the struts-config.

-->


</action>
<action path="/ChainedAction"
name="MyForm"
scope="request"
type="com.whatever.MyChainedActionClass">
<forward name="portlet.tiles.url.success.chainedAction" path="portlet.tiles.url.success.chainedAction.definedInTilesDef"/>
</action>
 
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic