struts源碼研究4 ActionForward
Posted on 2008-12-10 15:53 wesley1987 閱讀(547) 評論(0) 編輯 收藏 所屬分類: struts源碼學習 ActionForward繼承了下ForwardConfig,然后就寫了6個構造函數……然后就沒了 汗=。=!
有一句話沒翻譯出來,有看得懂的來幫個忙吧 :
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指向了一個目的地,由控制器執行跳轉。
* 但也可能作為Action中的行為,直接執行RequestDispatcher.forward或
* HttpServletResponse.sendRedirect方法。這個類的實例可以會根據需要被動態創建,
* 也可以被設定為與一個ActionMapping綁定,通過名字查找這個mapping實例的多個跳轉目的地。
*
* 一個ActionForward包含以下幾個基本屬性,其他的附加屬性可以根據需要由子類提供。
*
* contextRelative(上下文關系): path路徑值必須被解釋為上下文相關路徑(context-relative)
*
* name : 用來查找相關的ActionMapping。
* <li><strong>name</strong> - Logical name by which this instance may be
* looked up in relationship to a particular ActionMapping. </li>
*
* path : 一個讓控制器實現轉發(forward)的,模型相關/上下文相關URI;或一個讓控制器
* 實現重定向(redirected)的,絕對/相對URI。
*
* redirect : 當需要控制器以重定向的方法執行path時則設為true,否則為false
*
* 這個類繼承了 ForwardConfig 類和 contextRelative屬性
*
* 注意 :這個類不推薦使用,而應由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 {
/**
* 無參構造函數 - 以默認值實例化
*/
public ActionForward() {
this(null, false);
}
/**
* 構造函數 - 參數path</p>
*
*/
public ActionForward(String path) {
this(path, false);
}
/**
* 構造函數 - 參數 path,redirect
*/
public ActionForward(String path, boolean redirect) {
super();
setName(null);
setPath(path);
setRedirect(redirect);
}
/**
*構造函數 - 參數 name,path,redirect
*/
public ActionForward(String name, String path, boolean redirect) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
}
/**
* 構造函數 - 參數 name,path,redirect,module 模塊前綴
*/
public ActionForward(String name, String path, boolean redirect,
String module) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
setModule(module);
}
/**
* 構造函數 - 用已有的ActionForward對象實例化。
*/
public ActionForward(ActionForward copyMe) {
this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(),
copyMe.getModule());
}
}
import org.apache.struts.config.ForwardConfig;
/**
* 一個ActionForward為控制器類RequestProcessor指向了一個目的地,由控制器執行跳轉。
* 但也可能作為Action中的行為,直接執行RequestDispatcher.forward或
* HttpServletResponse.sendRedirect方法。這個類的實例可以會根據需要被動態創建,
* 也可以被設定為與一個ActionMapping綁定,通過名字查找這個mapping實例的多個跳轉目的地。
*
* 一個ActionForward包含以下幾個基本屬性,其他的附加屬性可以根據需要由子類提供。
*
* contextRelative(上下文關系): path路徑值必須被解釋為上下文相關路徑(context-relative)
*
* name : 用來查找相關的ActionMapping。
* <li><strong>name</strong> - Logical name by which this instance may be
* looked up in relationship to a particular ActionMapping. </li>
*
* path : 一個讓控制器實現轉發(forward)的,模型相關/上下文相關URI;或一個讓控制器
* 實現重定向(redirected)的,絕對/相對URI。
*
* redirect : 當需要控制器以重定向的方法執行path時則設為true,否則為false
*
* 這個類繼承了 ForwardConfig 類和 contextRelative屬性
*
* 注意 :這個類不推薦使用,而應由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 {
/**
* 無參構造函數 - 以默認值實例化
*/
public ActionForward() {
this(null, false);
}
/**
* 構造函數 - 參數path</p>
*
*/
public ActionForward(String path) {
this(path, false);
}
/**
* 構造函數 - 參數 path,redirect
*/
public ActionForward(String path, boolean redirect) {
super();
setName(null);
setPath(path);
setRedirect(redirect);
}
/**
*構造函數 - 參數 name,path,redirect
*/
public ActionForward(String name, String path, boolean redirect) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
}
/**
* 構造函數 - 參數 name,path,redirect,module 模塊前綴
*/
public ActionForward(String name, String path, boolean redirect,
String module) {
super();
setName(name);
setPath(path);
setRedirect(redirect);
setModule(module);
}
/**
* 構造函數 - 用已有的ActionForward對象實例化。
*/
public ActionForward(ActionForward copyMe) {
this(copyMe.getName(), copyMe.getPath(), copyMe.getRedirect(),
copyMe.getModule());
}
}