Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Struts' Action Include attribute 1

Status
Not open for further replies.

maxpower1

Programmer
Jul 29, 2001
488
US
Has anyone used the <include> attribute instead of <forward>? Both can be optionally defined under <action></action> tags.
I am doing some designs that requires me NOT to instantiate an action class BUT INSTEAD forwarding the String through the <include> attribute defined under <struts-config.xml>. Any samples on how to define it in struts-config.xml and implementation int the Struts class would be helpful.

thank you

~za~
You can't bring back a dead thread!
 
Hi,

Are you sure that we can use <include> in an <action>?
coz...
<action-mapping>
<action>
<set-property/>
<forward/>
<display-name/>
<exception/>
<icon/>
<description/>
</action>
<action-mapping/>

Cheers
-Venu
 
Sorry..

What's wrong with me.. I am sorry, I tought you were reffering to Nested elements of <action> tag.

Let me give a try and see what's the <include> and <forward> are in <action> tag.

Cheers,
-Venu
 
no problem man! yes you can use <include> instead of <forward> They both are mutually exclusive though. using <include> you can pass the result in the response object unlike <forward>. I think apache.?? .action.IncludeAction class is available. I'm trying to figure out how to use it now.

Instead of using <include> I could also use the &quot;IncludeAction&quot; class above using the <type> tag. Since <action> and <forward> are optional, they do not have to be incluced. Some articles also say that I can use RequestDispatcher to return the result(in String format). But what puzzle me is, the Action's execute() method returns an ActionForward class.

That's my problem right now. I don't know how to lego these pieces together.



~za~
You can't bring back a dead thread!
 
assuming you want map /myInclude to /myInclude.jsp
i.e. a user type will be same as
all you need to do in the struts config is

<action-mappings>
<action include=&quot;/myInclude.jsp&quot; path=&quot;/myInclude&quot; />
</action-mappings>

no Action class is need nor in instantiate in this case. Basically struts does nothing but forward your request to myInclude.jsp. Just like a URL rewrite
 
thanks byam!

~za~
You can't bring back a dead thread!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top