Action类的execute()方法返回一个ActionForward对象。ActionForward对象代表了Web资源的逻辑对象,这里的Web资源可以是JSP页面、JavaServlet或Action。
下面是ActionForward类的源代码:
下面是ActionForward类的源代码:
package org.apache.struts.action;
import org.apache.struts.config.ForwardConfig;
public class ActionForward extends ForwardConfig {
/**
* <p>Construct a new instance with default values.</p>
*/
public ActionForward() {
this(null, false);
}
/**
* <p>Construct a new instance with the specified path.</p>
*
* @param path Path for this instance
*/
public ActionForward(String path) {
this(path, false);
}
/**
* <p>Construct a new instance with the specified <code>path</code> and
* <code>redirect</code> flag.</p>
*
* @param path Path for this instance
* @param redirect Redirect flag for this instance
*/
public ActionForward(String path, boolean redirect) {
super();
setName(null);
setPath(path);
setRedirect(redirect);
}
/**
* <p>Construct a new instance with the specified <code>name</code>,
* <code>path</code> and <code>redirect</code> flag.</p>
*
* @param name Name of this instance
* @param path Path for this instance
* @param redirect Redirect flag for this instance
*/
public ActionForward(String name, String path, boolean redirect) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
}
/**
* <p>Construct a new instance with the specified values.</p>
*
* @param name Name of this forward
* @param path Path to which control should be forwarded or
* redirected
* @param redirect Should we do a redirect?
* @param module Module prefix, if any
*/
public ActionForward(String name, String path, boolean redirect,
String module) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
setModule(module);
}
/**
* <p>Construct a new instance based on the values of another
* ActionForward.</p>
*
* @param copyMe An ActionForward instance to copy
* @since Struts 1.2.1
*/
public ActionForward(ActionForward copyMe) {
this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(),
copyMe.getModule());
}
}