user2295633 user2295633 - 4 months ago 23
Java Question

In Struts 1, What is the Default Value of Type Attribute of <action> tag?

In Struts 1, if the type attribute of the tag has no value, what does it mean? Is there a default value for the type attribute that is used when it is not explicitly specified. I'm basically trying to figure out what the following action does; as you can see it has no type attribute; it only has path and forward attributes:

<action path="/a/b/comp" forward="/components/d/my-comp.jsp">
</action>

Answer

The action that you have included above simply redirects from /a/b/comp.do to /components/d/my-comp.jsp. It is a shorthand for the following:

<action path="/a/b/comp" 
        parameter="/components/d/my-comp.jsp"
        type="org.apache.struts.actions.ForwardAction">
      </action>

So, for the action that you have included the type attribute is org.apache.struts.actions.ForwardAction.