Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

forwarding between action classes

 
Dilish Kuruppath
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
 
Dom Lassy
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • 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
  • 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>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic