GeeCON Prague 2014*
The moose likes Struts and the fly likes Tags in struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Tags in struts2" Watch "Tags in struts2" New topic
Author

Tags in struts2

Sachin Raju
Ranch Hand

Joined: Oct 29, 2009
Posts: 41
Whats the difference between <result name= and <result type= tags inside the action tag? Which one is called at what point? Please suggest. And also what does <param name tag and method tag do?

<action name="delete" method="delete"
class="org.apache.struts2.showcase.action.EmployeeAction" >
<result name="error">/empmanager/editEmployee.jsp</result>
<result type="redirect">edit-${currentEmployee.empId}.action</result>
</action>


Is there any link which explains the tags in details
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

One is setting the result name with the default type, one sets the result type with the default name.

You'd use the appropriate one when you need to set on the attributes but not the other.

The Struts 2 documentation explains each of the configuration elements (not tags).
Nidhi Garg
Greenhorn

Joined: Jun 19, 2009
Posts: 21
There are basically 5 types present in Struts2. They are
- dispatcher
- Redirect
- rediretAction
- chain
- freemarker

If we dont specify the result type explicitly , by default it takes dispatcher
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't know why you limited yourself to five, particularly when one of the five, "chain", is actively discouraged. The "stream" result is also widely used, and those doing a lot of XML work use the "xslt" result type.
Nidhi Garg
Greenhorn

Joined: Jun 19, 2009
Posts: 21
well i read about those five only
 
GeeCON Prague 2014
 
subject: Tags in struts2