It's not a secret anymore!*
The moose likes Struts and the fly likes forwarding between action classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "forwarding between action classes" Watch "forwarding between action classes" New topic
Author

forwarding between action classes

Dilish Kuruppath
Greenhorn

Joined: Dec 21, 2005
Posts: 6
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

Joined: May 05, 2006
Posts: 181
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

Joined: Dec 21, 2005
Posts: 6
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>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forwarding between action classes
 
Similar Threads
Question on Tiles
Change color of clicked link - tiles
Having a problem with struts-tiles
Help: Not picking Struts-Tiles-Definition name...
URGENT::::::::Problem with Struts and Tiles