Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts IncludeAction
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Clark
IncludeAction
1 Answer(s)      4 years and a month ago
Posted in : Struts


What is IncludeAction ?


Advertisement
View Answers

November 20, 2010 at 12:48 PM


Hi friends,

This is an Action that includes the context-relative URI specified by the parameter property of our associated ActionMapping. This can be used to integrate Struts with other business logic components that are implemented as servlets or JSP pages, but still take advantage of the Struts controller servlet's functionality such as processing of form beans. To configure the use of this Action in our struts-config.xml file, create an entry like this:

<action 
    path="/saveDetail"
    type="org.apache.struts.actions.IncludeAction" 
    name="detailForm" 
    scope="request"
    input="/detail.jsp" 
    parameter="/path to processing servlet">

which will include the context-relative URI specified by the parameter attribute. This shorter form uses the include attribute:

<action
    path="/legacy"
    include="/legacy/roar"
    input="/form/userForm2.jsp"
    name="userForm"
    parameter="/legacy/roar"
    validate="true"
    scope="request"/>

The difference between the IncludeAction and the ForwardAction is that we need to use the IncludeAction only if the action is going to be included by another action or JSP. Therefore, if we have code in our JSP that looks like this:

<jsp:include page="/someWebApp/ someModule/someAction.do " />

The action could not use a ForwardAction because it would forward control to the new action rather than including its output within the output of the JSP-or throw a nasty IllegalStateException if the output buffer was already committed.

Thanks.



Related Tutorials/Questions & Answers:
IncludeAction
IncludeAction   What is IncludeAction
IncludeAction
IncludeAction  What is IncludeAction
Advertisements
IncludeAction
IncludeAction  What is IncludeAction
difference between ForwardAction and IncludeAction
difference between ForwardAction and IncludeAction  What is the difference between ForwardAction and IncludeAction
 

 

 

DMCA.com