struts源碼研究4 ActionForward
Posted on 2008-12-10 15:53 wesley1987 閱讀(548) 評論(0) 編輯 收藏 所屬分類: struts源碼學(xué)習(xí) ActionForward繼承了下ForwardConfig,然后就寫了6個構(gòu)造函數(shù)……然后就沒了 汗=。=!
有一句話沒翻譯出來,有看得懂的來幫個忙吧 :
NOTE - This class would have been deprecated and
replaced by org.apache.struts.config.ForwardConfig except for the fact that
it is part of the public API that existing applications are using.
下面是翻譯后的源碼。
有一句話沒翻譯出來,有看得懂的來幫個忙吧 :
NOTE - This class would have been deprecated and
replaced by org.apache.struts.config.ForwardConfig except for the fact that
it is part of the public API that existing applications are using.
下面是翻譯后的源碼。
package org.apache.struts.action;
import org.apache.struts.config.ForwardConfig;
/**
* 一個ActionForward為控制器類RequestProcessor指向了一個目的地,由控制器執(zhí)行跳轉(zhuǎn)。
* 但也可能作為Action中的行為,直接執(zhí)行RequestDispatcher.forward或
* HttpServletResponse.sendRedirect方法。這個類的實例可以會根據(jù)需要被動態(tài)創(chuàng)建,
* 也可以被設(shè)定為與一個ActionMapping綁定,通過名字查找這個mapping實例的多個跳轉(zhuǎn)目的地。
*
* 一個ActionForward包含以下幾個基本屬性,其他的附加屬性可以根據(jù)需要由子類提供。
*
* contextRelative(上下文關(guān)系): path路徑值必須被解釋為上下文相關(guān)路徑(context-relative)
*
* name : 用來查找相關(guān)的ActionMapping。
* <li><strong>name</strong> - Logical name by which this instance may be
* looked up in relationship to a particular ActionMapping. </li>
*
* path : 一個讓控制器實現(xiàn)轉(zhuǎn)發(fā)(forward)的,模型相關(guān)/上下文相關(guān)URI;或一個讓控制器
* 實現(xiàn)重定向(redirected)的,絕對/相對URI。
*
* redirect : 當(dāng)需要控制器以重定向的方法執(zhí)行path時則設(shè)為true,否則為false
*
* 這個類繼承了 ForwardConfig 類和 contextRelative屬性
*
* 注意 :這個類不推薦使用,而應(yīng)由ForwardConfig取代
..后面的翻不出來了。
* NOTE - This class would have been deprecated and
* replaced by org.apache.struts.config.ForwardConfig except for the fact that
* it is part of the public API that existing applications are using.</p>
*
*/
public class ActionForward extends ForwardConfig {
/**
* 無參構(gòu)造函數(shù) - 以默認(rèn)值實例化
*/
public ActionForward() {
this(null, false);
}
/**
* 構(gòu)造函數(shù) - 參數(shù)path</p>
*
*/
public ActionForward(String path) {
this(path, false);
}
/**
* 構(gòu)造函數(shù) - 參數(shù) path,redirect
*/
public ActionForward(String path, boolean redirect) {
super();
setName(null);
setPath(path);
setRedirect(redirect);
}
/**
*構(gòu)造函數(shù) - 參數(shù) name,path,redirect
*/
public ActionForward(String name, String path, boolean redirect) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
}
/**
* 構(gòu)造函數(shù) - 參數(shù) name,path,redirect,module 模塊前綴
*/
public ActionForward(String name, String path, boolean redirect,
String module) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
setModule(module);
}
/**
* 構(gòu)造函數(shù) - 用已有的ActionForward對象實例化。
*/
public ActionForward(ActionForward copyMe) {
this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(),
copyMe.getModule());
}
}
import org.apache.struts.config.ForwardConfig;
/**
* 一個ActionForward為控制器類RequestProcessor指向了一個目的地,由控制器執(zhí)行跳轉(zhuǎn)。
* 但也可能作為Action中的行為,直接執(zhí)行RequestDispatcher.forward或
* HttpServletResponse.sendRedirect方法。這個類的實例可以會根據(jù)需要被動態(tài)創(chuàng)建,
* 也可以被設(shè)定為與一個ActionMapping綁定,通過名字查找這個mapping實例的多個跳轉(zhuǎn)目的地。
*
* 一個ActionForward包含以下幾個基本屬性,其他的附加屬性可以根據(jù)需要由子類提供。
*
* contextRelative(上下文關(guān)系): path路徑值必須被解釋為上下文相關(guān)路徑(context-relative)
*
* name : 用來查找相關(guān)的ActionMapping。
* <li><strong>name</strong> - Logical name by which this instance may be
* looked up in relationship to a particular ActionMapping. </li>
*
* path : 一個讓控制器實現(xiàn)轉(zhuǎn)發(fā)(forward)的,模型相關(guān)/上下文相關(guān)URI;或一個讓控制器
* 實現(xiàn)重定向(redirected)的,絕對/相對URI。
*
* redirect : 當(dāng)需要控制器以重定向的方法執(zhí)行path時則設(shè)為true,否則為false
*
* 這個類繼承了 ForwardConfig 類和 contextRelative屬性
*
* 注意 :這個類不推薦使用,而應(yīng)由ForwardConfig取代

* NOTE - This class would have been deprecated and
* replaced by org.apache.struts.config.ForwardConfig except for the fact that
* it is part of the public API that existing applications are using.</p>
*
*/
public class ActionForward extends ForwardConfig {
/**
* 無參構(gòu)造函數(shù) - 以默認(rèn)值實例化
*/
public ActionForward() {
this(null, false);
}
/**
* 構(gòu)造函數(shù) - 參數(shù)path</p>
*
*/
public ActionForward(String path) {
this(path, false);
}
/**
* 構(gòu)造函數(shù) - 參數(shù) path,redirect
*/
public ActionForward(String path, boolean redirect) {
super();
setName(null);
setPath(path);
setRedirect(redirect);
}
/**
*構(gòu)造函數(shù) - 參數(shù) name,path,redirect
*/
public ActionForward(String name, String path, boolean redirect) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
}
/**
* 構(gòu)造函數(shù) - 參數(shù) name,path,redirect,module 模塊前綴
*/
public ActionForward(String name, String path, boolean redirect,
String module) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
setModule(module);
}
/**
* 構(gòu)造函數(shù) - 用已有的ActionForward對象實例化。
*/
public ActionForward(ActionForward copyMe) {
this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(),
copyMe.getModule());
}
}