org.apache.struts.actions
public class: IncludeAction [javadoc |
source]
java.lang.Object
org.apache.struts.action.Action
org.apache.struts.actions.IncludeAction
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 your
struts-config.xml
file, create an entry like this:
<action path="/saveSubscription"
type="org.apache.struts.actions.IncludeAction"
name="subscriptionForm"
scope="request"
input="/subscription.jsp"
parameter="/path/to/processing/servlet">
which will include the context-relative URI specified by the
parameter
attribute.
- version:
$
- Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
Field Summary |
---|
protected static MessageResources | messages | The message resources for this package. |
Method from org.apache.struts.actions.IncludeAction Summary: |
---|
execute |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.struts.actions.IncludeAction Detail: |
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
// Create a RequestDispatcher the corresponding resource
String path = mapping.getParameter();
if (path == null) {
throw new ServletException(messages.getMessage("include.path"));
}
RequestDispatcher rd =
servlet.getServletContext().getRequestDispatcher(path);
if (rd == null) {
throw new ServletException(messages.getMessage("include.rd", path));
}
// Unwrap the multipart request, if there is one.
if (request instanceof MultipartRequestWrapper) {
request = ((MultipartRequestWrapper) request).getRequest();
}
// Forward control to the specified resource
rd.include(request, response);
// Tell the controller servlet that the response has been created
return (null);
}
Process the specified HTTP request, and create the corresponding HTTP
response (or forward to another web component that will create it).
Return an ActionForward instance describing where and how
control should be forwarded, or null if the response has
already been completed. |