aspose file tools*
The moose likes Struts and the fly likes action chain tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "action chain tag" Watch "action chain tag" New topic
Author

action chain tag

Sachin Raju
Ranch Hand

Joined: Oct 29, 2009
Posts: 41
There is a action tag like this in my application. What happens here? whether the request goes to the render action or the page product_main.jsp is displayed? How to find this? Thanks

<action name="viewedit_ajax" com.tebs.augusta.web.actions.product.ProductAction_viewedit">
<result type="chain">render</result>
<result name="input">product_main.jsp</result>
</action>
Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

Sachin Raju wrote: whether the request goes to the render action or the page product_main.jsp is displayed?

product_main.jsp page will be displayed whenever your action returns a string as 'input'. Request will be forwarded to 'render' action if the action returns other than 'input' string.
If you do not provide 'name' attribute then it will treated as default one. When the string returned from the action do not have relevant result mapping then this default result will be used.
Attribute 'type' is used to tell what type of the result to be used.

action tag in your code is wrong, it is missing class attribute
Also please use code tags


A.A.Anbarasu
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Anbarasu Aladiyan wrote:If youhat do not provide 'name' attribute then it will treated as default one. When the string returned from the action do not have relevant result mapping then this default result will be used.

That's incorrect. If no "name" attribute is provided it gets the result name "success". Unless the action method returns "success" the result won't be used. If an action method returns a result name that is not defined you'll get an error message along the lines of "there is no result named 'xxx' defined for action yyy" or something similar.
Sachin Raju
Ranch Hand

Joined: Oct 29, 2009
Posts: 41
what happens to the chain type?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What do you mean?
Sachin Raju
Ranch Hand

Joined: Oct 29, 2009
Posts: 41
<result type="chain">render</result>
<result name="input">product_main.jsp</result>

Which will get executed?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

...

Whichever one your action says to.
Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

David Newton wrote:That's incorrect. If no "name" attribute is provided it gets the result name "success". Unless the action method returns "success" the result won't be used. If an action method returns a result name that is not defined you'll get an error message along the lines of "there is no result named 'xxx' defined for action yyy" or something similar.
Yup. I am sorry about it. David, thanks for pointing it out!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No apologies necessary :)
 
jQuery in Action, 2nd edition
 
subject: action chain tag