锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲中文字幕在线第六区,亚洲an日韩专区在线,久久久久亚洲AV无码去区首http://m.tkk7.com/ericli1982/category/15162.html瀛︿範鎺㈣寮婧愬拰web寮鍙?/description>zh-cnTue, 27 Feb 2007 11:57:45 GMTTue, 27 Feb 2007 11:57:45 GMT60Struts1.1婧愮爜瑙f瀽http://m.tkk7.com/ericli1982/archive/2006/09/13/69455.htmlericliericliWed, 13 Sep 2006 12:23:00 GMThttp://m.tkk7.com/ericli1982/archive/2006/09/13/69455.htmlhttp://m.tkk7.com/ericli1982/comments/69455.htmlhttp://m.tkk7.com/ericli1982/archive/2006/09/13/69455.html#Feedback0http://m.tkk7.com/ericli1982/comments/commentRss/69455.htmlhttp://m.tkk7.com/ericli1982/services/trackbacks/69455.htmlStruts1.1b3閮ㄥ垎婧愪唬鐮佸垎鏋?
浣滆咃細聽聽聽聽 鏂囩珷鏉ユ簮錛?br />璁塊棶嬈℃暟錛?嬈÷犅犅?鍔犲叆鏃墮棿錛?006-05-12

Struts1.1閮ㄥ垎婧愪唬鐮佸垎鏋?br />涓錛氳鏄?br />鏈枃閽堝Struts1.1b3鍋氬垎鏋愶紝涓昏甯屾湜閫氳繃瀵規簮浠g爜鐨勫垎鏋愰槓榪癝truts1.1鐨勫伐浣滄柟寮忋?br />鏈枃涓嶉傚悎鍒濆鑰呭弬鑰冿紝閫傚悎鍏鋒湁涓瀹氬熀浜嶴truts寮鍙戠殑紼嬪簭鍛樺弬鑰冦?br />涓嬮潰鐨勬弿榪幫紱閲岄潰灝嗕細瀵笰ctionServlet,RequestProcessor,ModuleConfig絳夊嚑涓被鍋氫竴浜?br />璇存槑銆備互娉ㄩ噴婧愪唬鐮佺殑鏂瑰紡錛岃鏄庡彇宸ヤ綔嫻佺▼銆?br />鐗瑰埆鐢蟲槑錛歋truts1.1浠g爜鐗堟潈灞炰簬Apache閬靛驚The Apache Software License, Version 1.1.
鏈枃鐗堟潈灞炰簬瀛ら瓊涓絎戜釜浜烘墍鏈夛紝浠諱綍涓漢鎴栫粍緇囧笇鏈涜漿杞斤紝璇蜂笌鎴戣仈緋匯傚茍鑾峰緱鎴戠殑鎺堟潈
鏂瑰彲杞澆銆?/p>

浜岋細ActionServlet鍒嗘瀽
鎴戜滑鍏堟潵鐪嬩竴涓嬩嬌鐢⊿truts鐨勯厤緗枃浠躲?/p>


action
org.apache.struts.action.ActionServlet


definitions-config
/WEB-INF/tiles-defs.xml,/WEB-INF/tiles-tests-defs.xml,/WEB-INF/tiles-tutorial-defs.xml,
/WEB-INF/tiles-examples-defs.xml


definitions-debug
0


definitions-parser-details
0


definitions-parser-validate
true

config
/WEB-INF/struts-config.xml

config/examples
/WEB-INF/struts-examples-config.xml

config/test
/WEB-INF/struts-tests-config.xml

config/tutorial
/WEB-INF/struts-tutorial-config.xml


validate
true


debug
2


detail
2

application
org.apache.struts.webapp.tiles.dev1-1.ApplicationResources


2


action
*.do

鎺ヤ笅鏉ユ垜浠潵鐪嬩竴涓婣ctionServlet鐨勫叿浣撲嬌鐢?br />javax.servlet.http.HttpServlet
|
|-->org.apache.struts.action.ActionServlet
鎵浠ユ湰璐ㄤ笂ActionServlet鏄竴涓櫘閫氱殑servlet錛岃礋璐e鐞?do涓哄悗緙鐨凥ttp璇鋒眰.
servlet鍦ㄦ墽琛宒oGet(),doPost(),涔嬪墠鍏堣皟鐢╥nit(),
浠ヤ笅鎴戜滑鍏堝垎鏋愪竴涓媔nit()鏂規硶
/**
* Initialize this servlet. Most of the processing has been factored into
* support methods so that you can override particular functionality at a
* fairly granular level.

* servlet鍒濆鍖栨搷浣?娉ㄦ剰鍒濆鍖栭『搴?br />* @exception ServletException if we cannot configure ourselves correctly
*/
public void init() throws ServletException {
//娉ㄦ剰鍒濆鍖栫殑欏哄簭
//Initialize our internal MessageResources bundle
initInternal();
//Initialize other global characteristics of the controller servlet
//澶勭悊涓浜涘叏灞鍙橀噺鐨勮緗錛歞ebug錛宒etail絳?br />initOther();
//Initialize the servlet mapping under which our controller servlet
//is being accessed. This will be used in the &html:form>
//tag to generate correct destination URLs for form submissions
//涓昏鏄敞鍐孌TD鏂囦歡浠ュ強瑙f瀽web.xml鍏充簬ActionServlet鐨勯厤緗傚鍚庣紑鍚嶇瓑.
// Configure the processing rules that we need
// digester.addCallMethod("web-app/servlet-mapping",
// "addServletMapping", 2);
// digester.addCallParam("web-app/servlet-mapping/servlet-name", 0);
// digester.addCallParam("web-app/servlet-mapping/url-pattern", 1);
//initServlet()鐨勪笂闈竴孌靛皢鎶奡truts榛樿鐨勫悗緙鍚嶄粠web.xml涓В鏋愬緱鍒?br />//涔熷氨鏄痺eb.xml涓殑濡備笅閰嶇疆錛?br />//
//action
//*.do
//榛樿浠?do緇撳熬鐨勮姹傞兘灝嗙敱Struts鏉ュ鐞嗭紝浣犲彲浠ヨ嚜宸變慨鏀?br />//
initServlet();

// Initialize modules as needed
//鍦ˋttribute涓繚瀛樼被瀹炰緥
getServletContext().setAttribute(Globals.ACTION_SERVLET_KEY, this);
//鏍規嵁閰嶇疆鏂囦歡鐢熸垚ModuleConfig,榪欐槸寰堥噸瑕佺殑涓姝?涓嬮潰浼氫笓闂ㄥ垎鏋?br />//鍦╰iles鐨勯厤緗腑鍏堣В鏋愭敞閲婁負"Mark 0"鐨勪竴涓厤緗枃浠?/WEB-INF/struts-config.xml
//浣跨敤initModuleConfig鏂規硶瑙f瀽XML鏂囦歡.
//鍙傛暟涓簆refix錛?",paths:"/WEB-INF/struts-config.xml"
ModuleConfig moduleConfig = initModuleConfig("", config);
//鍒濆鍖朚essage
initModuleMessageResources(moduleConfig);
//鍒濆鍖朖DBC DataSource
initModuleDataSources(moduleConfig);
//鍒濆鍖朠lunIn
initModulePlugIns(moduleConfig);

moduleConfig.freeze();
//鍦⊿truts1.1浠ュ悗鍙互浣跨敤澶氫釜閰嶇疆鏂囦歡,鍦ㄨВ鏋愬畬榛樿鐨勯厤緗枃浠朵篃灝辨槸涓婇潰鎻愬埌鐨?br />//娉ㄩ噴涓?Mark 0"鐨勪竴涓厤緗枃浠?/WEB-INF/struts-config.xml鍚庤В鏋愬叾浠栫殑閰嶇疆鏂囦歡
Enumeration names = getServletConfig().getInitParameterNames();
//渚濇瑙f瀽娉ㄩ噴涓?Mark 1"銆?Mark 2"銆?Mark 3"瀵瑰簲閰嶇疆鏂囦歡
while (names.hasMoreElements()) {
//姣忎竴涓厤緗枃浠剁殑鏂囦歡鍚?br />String name = (String) names.nextElement();
if (!name.startsWith("config/")) {
continue;
}
//
String prefix = name.substring(6);
moduleConfig = initModuleConfig
(prefix, getServletConfig().getInitParameter(name));

initModuleMessageResources(moduleConfig);
initModuleDataSources(moduleConfig);
initModulePlugIns(moduleConfig);
moduleConfig.freeze();
}
destroyConfigDigester();

}
/**
* 姝ゆ柟娉曚嬌鐢―igester瑙f瀽XML,鍏充簬浣跨敤Digester鐨勪粙緇嶅弬鐪嬫垜鐨勫彟澶栦竴綃囨枃绔?br />*
Initialize the application configuration information for the
* specified module.


*
* @param prefix Module prefix for this module
* @param paths Comma-separated list of context-relative resource path(s)
* for this modules's configuration resource(s)
*
* @exception ServletException if initialization cannot be performed
* @since Struts 1.1
*/
protected ModuleConfig initModuleConfig
(String prefix, String paths) throws ServletException {

if (log.isDebugEnabled()) {
log.debug("Initializing module path '" + prefix +
"' configuration from '" + paths + "'");
}

// Parse the configuration for this module
ModuleConfig config = null;
InputStream input = null;
String mapping = null;
try {
//宸ュ巶鏂規硶鍒涘緩ModuleConfig鏍囪涓猴細prefix
ModuleConfigFactory factoryObject =
ModuleConfigFactory.createFactory();
config = factoryObject.createModuleConfig(prefix);

// Support for module-wide ActionMapping type override
mapping = getServletConfig().getInitParameter("mapping");
if (mapping != null) {
config.setActionMappingClass(mapping);
}

// Configure the Digester instance we will use
//寰楀埌瑙f瀽XML鐨刣igester
Digester digester = initConfigDigester();

// Process each specified resource path
while (paths.length() > 0) {
//寮濮嬭В鏋愭寚瀹氳礬寰勬枃浠跺悕鐨勬枃浠?br />digester.push(config);
String path = null;
//鏂囦歡鏄惁涓哄涓茍涓斾嬌鐢?,"鍒嗗壊
int comma = paths.indexOf(',');
//瀛樺湪澶氫釜閰嶇疆鏂囦歡
if (comma >= 0) {
//鍏堣В鏋愮涓涓?br />path = paths.substring(0, comma).trim();
//paths瀛樻斁鍓╀綑鐨勬枃浠跺悕涓嬫鍐嶅鐞?br />paths = paths.substring(comma + 1);
} else {
//褰撳墠鍙瓨鍦ㄤ竴涓?br />path = paths.trim();
//娌℃湁鍓╀綑,涓嬫寰幆鏍規嵁涓婇潰涓鍙ュ皢浼氬湪鍞竴鐨勫驚鐜鍑虹偣"point break"
//閫鍑哄驚鐜?br />paths = "";
}
//鍏ㄩ儴瑙f瀽瀹屾垚璺沖嚭寰幆
//point break
if (path.length() < 1) {
break;
}
//鏍規嵁鏂囦歡鍚嶅彇鏂囦歡
URL url = getServletContext().getResource(path);
InputSource is = new InputSource(url.toExternalForm());
input = getServletContext().getResourceAsStream(path);
is.setByteStream(input);
digester.parse(is);
//鍏ㄥ眬鍙橀噺鐨勫艦寮忔妸瑙f瀽鐢熸垚鐨凪oduleConfig瀹炰緥淇濆瓨璧鋒潵
//濡?Mark 1"澶勬爣璁扮殑"config/examples",
//key涓猴細"org.apache.struts.action.MODULEexamples"
//Globals.MODULE_KEY鍊間負:org.apache.struts.action.MODULE
getServletContext().setAttribute
(Globals.MODULE_KEY + prefix, config);
input.close();
}

} catch (Throwable t) {
log.error(internal.getMessage("configParse", paths), t);
throw new UnavailableException
(internal.getMessage("configParse", paths));
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
;
}
}
}

// Force creation and registration of DynaActionFormClass instances
// for all dynamic form beans we wil be using
//鏍規嵁ModuleConfig瀹炰緥寰楀埌閰嶇疆鐨凢ormBean鐨勯厤緗?br />//娉ㄦ剰錛氬洜涓哄湪Struts鏁翠釜榪愯褰撲腑FormBean鐨勫疄渚嬭鍦ˋction鐨勫疄渚嬪垱寤轟箣鍓嶅厛鍒涘緩
//鍥犱負Action鎵цperform(1.1浠ュ墠)錛宔xecute錛?.1錛夐渶瑕佷嬌鐢ㄥ埌FormBean
FormBeanConfig fbs[] = config.findFormBeanConfigs();
for (int i = 0; i < fbs.length; i++) {
if (fbs[i].getDynamic()) {
DynaActionFormClass.createDynaActionFormClass(fbs[i]);
}
}

// Special handling for the default module (for
// backwards compatibility only, will be removed later)
//涓嬮潰鏄敓鎴愪竴浜涘疄渚?br />if (prefix.length() < 1) {
defaultControllerConfig(config);
defaultMessageResourcesConfig(config);
defaultFormBeansConfig(config);
defaultForwardsConfig(config);
defaultMappingsConfig(config);
}

// Return the completed configuration object
//config.freeze(); // Now done after plugins init
return (config);

}

鍒版鍒濆鍖栧伐浣滃熀鏈粨鏉燂紝涓嬮潰灝嗗鐞嗗叿浣撶殑Http璇鋒眰銆傚湪Servlet鍗忚涓墍鏈夌殑post鏂規硶灝嗚皟鐢?br />浠ヤ笅鏂規硶鏉ュ鐞?br />public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {}
get鏂規硶涔熻皟鐢ㄧ被浼肩殑鏂規硶鏉ュ鐞?

鍦⊿truts涓璸ost,get鏂規硶閮借皟鐢ㄥ悓涓涓柟娉?br />process(request, response);鏉ュ鐞嗗叿浣撶殑璇鋒眰
濡備笅錛?br />/**
* 瀵規瘡涓涓彁浜よ繃鏉ョ殑Action榪涜澶勭悊
* Perform the standard request processing for this request, and create
* the corresponding response.
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception is thrown
*/
protected void process(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
//璁劇疆鎴栧垹闄ttribute
RequestUtils.selectModule(request, getServletContext());
//鍏蜂綋鐨勫鐞嗕氦緇橰equestProcessor鍘誨鐞咹ttpRequest,HttpResponse
//榪欐槸涓涓緢鍏稿瀷鐨勮璁℃ā寮?br />//涓嬮潰鎴戜滑灝嗚緇嗘潵鍒嗘瀽RequestProcessor錛屽緢瀹規槗鐞嗚ВStruts鐨勮繍琛屾柟寮?br />getRequestProcessor(getModuleConfig(request)).process(request, response);
}

涓?RequestProcessor鍒嗘瀽
閫氳繃鍓嶉潰鐨勫垎鏋愭垜浠煡閬揝truts涓HttpRequest,HttpResponse鐨勫鐞嗛兘浜ょ粰RequestProcessor
鐨刾rocess錛堬級鏂規硶鏉ュ鐞嗐備笅闈㈡垜浠潵鐪嬬湅process鏂規硶
/**
*
Process an HttpServletRequest and create the
* corresponding HttpServletResponse.


*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a processing exception occurs
*/
public void process(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {

// Wrap multipart requests with a special wrapper
//濡傛灉鏄痷pload,榪斿洖涓涓狹ultipartRequestWrapper()
request = processMultipart(request);

// Identify the path component we will use to select a mapping
//瀵箁equest榪涜鍒嗘瀽寰楀埌鎻愪氦榪囨潵鐨凢orm Action
String path = processPath(request, response);
if (path == null) {
return;
}
if (log.isInfoEnabled()) {
log.info("Processing a '" + request.getMethod() +
"' for path '" + path + "'");
}

// Select a Locale for the current user if requested
//鏈湴鍖栧鐞?br />processLocale(request, response);

// Set the content type and no-caching headers if requested
processContent(request, response);
//璁劇疆Cache涓嶄繚瀛?br />processNoCache(request, response);

// General purpose preprocessing hook
if (!processPreprocess(request, response)) {
return;
}

// Identify the mapping for this request
//寰楀埌path浠ュ悗錛屾牴鎹厤緗枃浠?struts-config.xml)鐨勭浉鍏抽厤緗潵寰楀埌涓涓?br />//ActionMapping鐨勫疄渚?br />//ActionMapping緇ф壙ActionConfig
//浠旂粏鐪嬩竴涓婣ctionMapping鐨勪唬鐮佸氨鑳藉彂鐜幫細
//涓嬮潰鐨勪竴孌靛皢瑙f瀽褰卞皠涓涓狝ctionMapping鐨勫疄渚?br />//鍦ˋctionServlet鍦ㄥ垵濮嬪寲鐨勬椂鍊欏疄闄呬笂宸茬粡鎶婃墍鏈夌殑ActionMapping鐨勫疄渚?br />//閮藉凡緇忓垱寤哄ソ浜嗐俻rocessMapping鏂規硶瀹為檯涓婃槸浠嶢ttribute涓幓寰楀埌宸茬粡
//淇濆瓨濂界殑ActionMapping鐨勫疄渚嬶紝鍙互鐞嗚В涓哄湪Tomcat鍚姩鐨勬椂鍊欏凡緇?br />//鎶婃墍鏈夌殑ActionMapping淇濆瓨鍦ˋttribute閲岄潰銆傛墍浠ュ湪Tomcat鍚姩鐨勬椂鍊?br />//姣旇緝鎱紝濡傛灉Struts-config.xml鏈夐棶棰樺惎鍔ㄥ氨浼氬嚭閿欍?br />/***

type="org.apache.struts.webapp.tiles.test.TestActionTileAction">

**/
//****娉ㄦ剰寰楀埌鍒涘緩瀹炰緥鐨勯『搴?br />//ActionMapping瀹炰緥宸茬粡鍒涘緩濂戒簡錛岀幇鍦ㄤ粠Atribute涓彇鍒?br />ActionMapping mapping = processMapping(request, response, path);
if (mapping == null) {
return;
}

// Check for any role required to perform this action
if (!processRoles(request, response, mapping)) {
return;
}

// Process any ActionForm bean related to this request
//鏍規嵁mapping寰楀埌ActionForm鐨勫疄渚嬨?br />//鍚屽悕ActionForm鍦ㄧ郴緇熶腑鍙細鍒涘緩涓嬈°?br />ActionForm form = processActionForm(request, response, mapping);
//鍘嬫爤
processPopulate(request, response, form, mapping);
//澶勭悊鏍¢獙,璋冪敤ActionForm鐨剉alidate鏂規硶
//鍋囧鍑洪敊灝嗕細榪斿洖鍒板墠涓欏甸潰
//涔熷氨鏄鍦ˋction榪樻病鏈夊垱寤轟箣鍓嶅氨灝嗗仛鏍¢獙
if (!processValidate(request, response, form, mapping)) {
return;
}

// Process a forward or include specified by this mapping
if (!processForward(request, response, mapping)) {
return;
}
if (!processInclude(request, response, mapping)) {
return;
}

// Create or acquire the Action instance to process this request
//鍦ㄥ緱鍒癆ctionMapping銆丄ctionForm鐨勫疄渚嬪悗鎺ヤ笅鏉ュ緱鍒癆ction瀹炰緥
//瀹炰緥濡傛灉宸茬粡鍒涘緩浠嶮ap閲岄潰鍘誨彇濡傛灉娌℃湁鍒涘緩涓涓茍淇濆瓨鍦∕ap閲岄潰
//瀵逛繚瀛楢ction瀹炰緥鐨凪ap 瀹炵幇綰跨▼鍚屾
Action action = processActionCreate(request, response, mapping);
if (action == null) {
return;
}

// Call the Action instance itself
//鍦ˋctionMapping銆丄ctionForm銆丄ction瀹炰緥鍒涘緩濂戒互鍚?br />//璋冪敤Action鐨別xecute()鏂規硶寰楀埌涓涓狝ctionForward
//鍥犱負鎵鏈夌殑鍙墽琛孉ction閮藉繀欏繪湁override Action鐨別xecute()/perform()鏂規硶
ActionForward forward =
processActionPerform(request, response,
action, form, mapping);

// Process the returned ActionForward instance
//Action宸茬粡姝e父鎵ц錛屾墽琛岀粨鏉熷悗灝嗚繑鍥炲埌鍙﹀涓涓〉闈?br />processActionForward(request, response, forward);

}

浠旂粏闃呰涓婇潰鐨勪唬鐮侊紝瑕佺壒鍒敞鎰廇ctionMapping銆丄ctionForm銆丄ction鐨勫疄渚嬫槸渚濇鍒涘緩鐨勩?br />鍒涘緩瀹屼互鍚庢墠鍘繪墽琛孉ction鐨別xecute()鏂規硶銆備負浠涔堣渚濇鍒涘緩ActionMapping銆丄ctionForm
銆丄ction??????


鍥?ModuleConfig鍒嗘瀽
鐜板湪鎴戜滑寰堟湁蹇呰浜嗚В涓涓婱oduleConfig榪欎釜綾伙紝鍥犱負澶鍦版柟鐢ㄥ埌浜嗐?br />瀹為檯涓奙oduleConfig鏄竴涓帴鍙f湁涓涓疄鐜般俹rg.apache.struts.config.impl.ModuleConfigImpl
鍏蜂綋瀹炵幇鎴戝氨娌℃湁涓嶈鍘誨垎鏋愪簡銆傛垜浠潵鐪嬬湅榪欎釜鎺ュ彛銆?/p>

package org.apache.struts.config;

/**
*
The collection of static configuration information that describes a
* Struts-based module. Multiple modules are identified by
* a prefix at the beginning of the context
* relative portion of the request URI. If no module prefix can be
* matched, the default configuration (with a prefix equal to a zero-length
* string) is selected, which is elegantly backwards compatible with the
* previous Struts behavior that only supported one module.


*
* @author Rob Leland
* @version $Revision: 1.2 $ $Date: 2002/12/22 05:31:14 $
* @since Struts 1.1
*/
public interface ModuleConfig {
/**
* Has this module been completely configured yet. Once this flag
* has been set, any attempt to modify the configuration will return an
* IllegalStateException.
*/
boolean getConfigured();

/**
* The controller configuration object for this module.
*/
ControllerConfig getControllerConfig();
/**
* The controller configuration object for this module.
* @param cc The controller configuration object for this module.
*/

void setControllerConfig(ControllerConfig cc);

/**
* The prefix of the context-relative portion of the request URI, used to
* select this configuration versus others supported by the controller
* servlet. A configuration with a prefix of a zero-length String is the
* default configuration for this web module.
*/
String getPrefix();

/**
* The prefix of the context-relative portion of the request URI, used to
* select this configuration versus others supported by the controller
* servlet. A configuration with a prefix of a zero-length String is the
* default configuration for this web module.
*/
public void setPrefix(String prefix);
/**
* The default class name to be used when creating action mapping
* instances.
*/
String getActionMappingClass();
/**
* The default class name to be used when creating action mapping
* instances.
* @param actionMappingClass default class name to be used when creating action mapping
* instances.
*/

void setActionMappingClass(String actionMappingClass);

/**
* Add a new ActionConfig instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addActionConfig(ActionConfig config);

/**
* Add a new DataSourceConfig instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addDataSourceConfig(DataSourceConfig config);

/**
* Add a new ExceptionConfig instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addExceptionConfig(ExceptionConfig config);

/**
* Add a new FormBeanConfig instance to the set associated
* with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addFormBeanConfig(FormBeanConfig config);

/**
* Add a new ForwardConfig instance to the set of global
* forwards associated with this module.
*
* @param config The new configuration instance to be added
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void addForwardConfig(ForwardConfig config);

/**
* Add a new MessageResourcesConfig instance to the set
* associated with this module.
*
* @param config The new configuration instance to be added
*
* @exception IllegalStateException if this module configuration
* has been frozen
*/
void addMessageResourcesConfig(MessageResourcesConfig config);

/**
* Add a newly configured {@link org.apache.struts.config.PlugInConfig} instance to the set of
* plug-in Actions for this module.
*
* @param plugInConfig The new configuration instance to be added
*/
void addPlugInConfig(PlugInConfig plugInConfig);

/**
* Return the action configuration for the specified path, if any;
* otherwise return null.
*
* @param path Path of the action configuration to return
*/
ActionConfig findActionConfig(String path);

/**
* Return the action configurations for this module. If there are
* none, a zero-length array is returned.
*/
ActionConfig[] findActionConfigs();

/**
* Return the data source configuration for the specified key, if any;
* otherwise return null.
*
* @param key Key of the data source configuration to return
*/
DataSourceConfig findDataSourceConfig(String key);

/**
* Return the data source configurations for this module. If there
* are none, a zero-length array is returned.
*/
DataSourceConfig[] findDataSourceConfigs();

/**
* Return the exception configuration for the specified type, if any;
* otherwise return null.
*
* @param type Exception class name to find a configuration for
*/
ExceptionConfig findExceptionConfig(String type);

/**
* Return the exception configurations for this module. If there
* are none, a zero-length array is returned.
*/
ExceptionConfig[] findExceptionConfigs();

/**
* Return the form bean configuration for the specified key, if any;
* otherwise return null.
*
* @param name Name of the form bean configuration to return
*/
FormBeanConfig findFormBeanConfig(String name);

/**
* Return the form bean configurations for this module. If there
* are none, a zero-length array is returned.
*/
FormBeanConfig[] findFormBeanConfigs();

/**
* Return the forward configuration for the specified key, if any;
* otherwise return null.
*
* @param name Name of the forward configuration to return
*/
ForwardConfig findForwardConfig(String name);

/**
* Return the form bean configurations for this module. If there
* are none, a zero-length array is returned.
*/
ForwardConfig[] findForwardConfigs();

/**
* Return the message resources configuration for the specified key,
* if any; otherwise return null.
*
* @param key Key of the data source configuration to return
*/
MessageResourcesConfig findMessageResourcesConfig(String key);

/**
* Return the message resources configurations for this module.
* If there are none, a zero-length array is returned.
*/
MessageResourcesConfig[] findMessageResourcesConfigs();

/**
* Return the configured plug-in actions for this module. If there
* are none, a zero-length array is returned.
*/
PlugInConfig[] findPlugInConfigs();

/**
* Freeze the configuration of this module. After this method
* returns, any attempt to modify the configuration will return
* an IllegalStateException.
*/
void freeze();

/**
* Remove the specified action configuration instance.
*
* @param config ActionConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeActionConfig(ActionConfig config);

/**
* Remove the specified exception configuration instance.
*
* @param config ActionConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeExceptionConfig(ExceptionConfig config);

/**
* Remove the specified data source configuration instance.
*
* @param config DataSourceConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeDataSourceConfig(DataSourceConfig config);

/**
* Remove the specified form bean configuration instance.
*
* @param config FormBeanConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeFormBeanConfig(FormBeanConfig config);

/**
* Remove the specified forward configuration instance.
*
* @param config ForwardConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeForwardConfig(ForwardConfig config);

/**
* Remove the specified message resources configuration instance.
*
* @param config MessageResourcesConfig instance to be removed
*
* @exception java.lang.IllegalStateException if this module configuration
* has been frozen
*/
void removeMessageResourcesConfig(MessageResourcesConfig config);
}


涓婇潰鐨勬敞閲婂凡緇忛潪甯告竻鏅頒簡銆傛垜灝變笉鍘繪氮璐瑰ぇ瀹剁殑鏃墮棿浜嗭紝鍐嶆兂浠旂粏鐪嬪氨鍘葷湅浠栫殑瀹炵幇銆?br />鍏跺疄涓昏鏄HashMap()鐨勫鐞嗐?/p>

浜旓細ActionMapping鍒嗘瀽
鏈鍚庢垜浠疄鐜板緢鏈夊繀瑕佺湅涓涓婣ctionMapping,鍥犱負浣犲鏋滄兂娓呮鐨勪簡瑙truts-config.xml
榪欎釜閰嶇疆鏂囦歡鐨勪綔鐢紝浣犲簲璇ヨ鐭ラ亾ActionMapping
鍓嶉潰宸茬粡璇磋繃ActionMapping緇ф壙ActionConfig
浠ヤ笅灝辨槸ActionMapping鍔犵殑鍥涗釜鏂規硶銆?br />/**
*
Find and return the ExceptionConfig instance defining
* how exceptions of the specified type should be handled. This is
* performed by checking local and then global configurations for the
* specified exception's class, and then looking up the superclass chain
* (again checking local and then global configurations). If no handler
* configuration can be found, return null.


*
* @param type Exception class for which to find a handler
* @since Struts 1.1
*/
public ExceptionConfig findException(Class type) {

}


/**
*
Find and return the ForwardConfig instance defining
* how forwarding to the specified logical name should be handled. This is
* performed by checking local and then global configurations for the
* specified forwarding configuration. If no forwarding configuration
* can be found, return null.


*
* @param name Logical name of the forwarding instance to be returned
*/
public ActionForward findForward(String name) {

}


/**
*
Return the logical names of all locally defined forwards for this
* mapping. If there are no such forwards, a zero-length array
* is returned.
*/
public String[] findForwards() {
}


/**
*

Create (if necessary) and return an {@link ActionForward} that
* corresponds to the input property of this Action.
*
* @since Struts 1.1b2
*/
public ActionForward getInputForward() {

}

榪樻槸鐪嬩互涓嬩粬鐨勫熀綾籄ctionConfig鍚?br />public class ActionConfig implements Serializable {

/**
* Has configuration of this component been completed?
*/
protected boolean configured = false;

/**
* The set of exception handling configurations for this
* action, if any, keyed by the type property.
*/
protected HashMap exceptions = new HashMap();

/**
* The set of local forward configurations for this action, if any,
* keyed by the name property.
*/
protected HashMap forwards = new HashMap();

/**
* The module configuration with which we are associated.
*/
protected ModuleConfig moduleConfig = null;

/**
* The request-scope or session-scope attribute name under which our
* form bean is accessed, if it is different from the form bean's
* specified name.
*/
protected String attribute = null;

/**
* Context-relative path of the web application resource that will process
* this request via RequestDispatcher.forward(), instead of instantiating
* and calling the Action class specified by "type".
* Exactly one of forward, include, or
* type must be specified.
*/
protected String forward = null;

/**
* Context-relative path of the web application resource that will process
* this request via RequestDispatcher.include(), instead of instantiating
* and calling the Action class specified by "type".
* Exactly one of forward, include, or
* type must be specified.
*/
protected String include = null;

/**
* Context-relative path of the input form to which control should be
* returned if a validation error is encountered. Required if "name"
* is specified and the input bean returns validation errors.
*/
protected String input = null;

/**
* Fully qualified Java class name of the
* MultipartRequestHandler implementation class used to
* process multi-part request data for this Action.
*/
protected String multipartClass = null;

/**
* Name of the form bean, if any, associated with this Action.
*/
protected String name = null;

/**
* General purpose configuration parameter that can be used to pass
* extra iunformation to the Action instance selected by this Action.
* Struts does not itself use this value in any way.
*/
protected String parameter = null;

/**
* Context-relative path of the submitted request, starting with a
* slash ("/") character, and omitting any filename extension if
* extension mapping is being used.
*/
protected String path = null;

/**
* Prefix used to match request parameter names to form ben property
* names, if any.
*/
protected String prefix = null;

/**
* Comma-delimited list of security role names allowed to request
* this Action.
*/
protected String roles = null;

/**
* Identifier of the scope ("request" or "session") within which
* our form bean is accessed, if any.
*/
protected String scope = "session";

/**
* Suffix used to match request parameter names to form bean property
* names, if any.
*/
protected String suffix = null;

/**
* Fully qualified Java class name of the Action class
* to be used to process requests for this mapping if the
* forward and include properties are not set.
* Exactly one of forward, include, or
* type must be specified.
*/
protected String type = null;

/**
* Should the validate() method of the form bean associated
* with this action be called?
*/
protected boolean validate = true;
}

鍏跺疄ActionConfig鏄竴涓緢鍏稿瀷鐨刅alueObject.鎵浠ュ叾浠栫殑get/set鏂規硶鎴戝氨涓嶅啓鍑烘潵浜嗐?br />鐪嬭繖涓唬鐮佷竴瀹氳鍜宻truts-config.xml涓璧鋒潵鐪嬶紝鏍規嵁struts-config.xml鍘繪壘鎵?br />姣忎竴孌甸厤緗枃浠舵渶緇堣鐢熸垚涓涓狝ctionConfig,浠栦滑涔嬮棿鐨勫搴斿叧緋匯?br />濡傛灉浣犳兂鎵╁睍Struts,ActionMapping浼拌浣犱竴瀹氳淇敼銆傝繕鏈堿ctionServlet浣犱篃瑕佷慨鏀廣?/p>

鍏細緇撴潫璇?br />鍒嗘瀽浜嗕竴浜涗唬鐮佷笅闈㈠仛涓浜涙榪般傚厛鏉ユ暣浣撶殑浜嗚В涓涓婼truts鐨勫伐浣滄祦紼?
鍦ㄥ疄鐜頒竴涓熀浜嶴truts鐨勮繍鐢ㄤ箣鍓嶆垜浠鍏堟槸鍋氱幆澧冭緗紝Struts姝e父宸ヤ綔闇瑕佽嚦灝戜袱涓?br />閰嶇疆鏂囦歡web.xml,struts-config.xml.
web.xml鍛婅瘔App Server鎵鏈変互.do緇撳熬鐨勮姹傛渶緇堟彁浜ょ粰ActionServlet鍘誨鐞嗐?br />2灝辮瀹欰ctionServlet鏄湪App Server鍚姩鐨勬椂鍊?br />鍒涘緩鐨勫茍涓斾竴鐩村瓨鍦ㄣ?br />ActionServlet鍦ㄥ垱寤虹殑鏃跺欎細鍋氬涓嬬殑宸ヤ綔錛?br />淇濆瓨涓浜涘悗闈㈤渶瑕佷嬌鐢ㄧ殑瀹炰緥鍦ˋttribute(鍐呭瓨)閲岄潰銆?br />鏍規嵁web.xml鐨勯厤緗В鏋恠truts-config.xml鏂囦歡銆?br />鏍規嵁struts-config.xml鐨勯厤緗敓鎴怉ctionMapping瀹炰緥騫朵笖淇濆瓨銆?/p>

ActionServlet鍦ㄧ敓鍛藉懆鏈熷氨涓鐩寸瓑寰匟ttp 璇鋒眰
姣忎竴涓?do緇撳熬鐨凥ttp 璇鋒眰閮界敱ActionServlet鍏堟埅鑾風劧鍚庢牴鎹姹傝礬寰勫緱鍒板叿浣撹皟鐢ㄩ偅
涓涓狝ction鍘誨鐞嗭紝鍦ㄨ繖涔嬪墠鐢熸垚銆佸鐞咥ctionForm銆傚叿浣撶煡閬撻偅涓涓狝ction鍘誨鐞嗚姹?br />鍚庤皟鐢ˋction鐨別xecute()/perform()澶勭悊瀹屾垚錛岃繑鍥炪?/p>





ericli 2006-09-13 20:23 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 一二三四影视在线看片免费 | 午夜视频在线在免费| 亚洲国色天香视频| 中文字幕在线免费| 亚洲第一网站免费视频| 7723日本高清完整版免费| 国产成人精品日本亚洲18图| 动漫黄网站免费永久在线观看| 亚洲一欧洲中文字幕在线| 成年性羞羞视频免费观看无限| 亚洲熟女www一区二区三区| 成在人线AV无码免费| 美女一级毛片免费观看 | 久久综合图区亚洲综合图区| 日韩视频免费在线观看| 亚洲精品国产免费| 四虎在线免费播放| 午夜成人无码福利免费视频| 久久久久亚洲av毛片大| 华人在线精品免费观看| 亚洲综合小说久久另类区| 久久精品免费一区二区喷潮| 亚洲aⅴ天堂av天堂无码麻豆| 亚洲午夜无码AV毛片久久| 国产一级淫片a免费播放口| 亚洲综合小说久久另类区| 日韩电影免费在线观看视频| 人禽伦免费交视频播放| 亚洲av激情无码专区在线播放| 黄+色+性+人免费| 鲁啊鲁在线视频免费播放| 亚洲AV日韩AV永久无码久久| 可以免费看黄的网站| 人妻仑乱A级毛片免费看| 久久精品亚洲精品国产色婷| 成人免费777777| 全黄大全大色全免费大片| xxx毛茸茸的亚洲| 中文字幕第一页亚洲| av大片在线无码免费| 久久精品成人免费观看97|