--=====================ActionMappingDefinitions-->
--ÅäÖÃactionmapping-->
--======================ControllerConfiguration-->
--Titles-->
--ÅäÖÃÏûÏ¢×ÊÔ´Îļþ-->
--======================PlugInsConfiguration-->
--=============Titlespugin================-->
--
ThisplugininitializeTitlesdefinitionfactory.Thislatercantakessomeparamtersexplainedhereafter.
Thepluginfirstreadparamtersfromweb.xml,thenoverloadthemwithparamtersdefinedhere.Allparamtersareoptional.
Thepluginshouldbedeclaredineachstruts-configfile.
-definitions-config:
(optional)
Specifyconfigurationfilenames.Therecanbeseveralcommaseparatedfilenames(degalut:
?
?
)
-moduleAware:
(optional-struts1.1)
SpecifyiftheTitlesdefinitionfactoryismoduleaware,iftrue(default),therewillbeonefactoryforeachStrutsmodule.
Iffalse,therewilllbeonecommonfactoryforallmodule.Inthislatercase,
itisstillneededtodeclareonepluginpermodule.
Thefactorywillbeinitializedwithparamtersfoundinthefirstinitializedplugin(generallytheoneassociatedwiththe
defaultmodule).
true:
Onefactorypermodule.(default)
falase:
onesinglesharedfactoryforallmodules
-definitions-parser-validate:
(optional)
SpecifyifxmlparsershouldvalidatetheTitlesconfigurationfile.
ture:
validate.DTDshouldbespecifiedinfileheader.(default)
false:
novalidation
PathsfoundinTitlesdefinitionsarerelativetothemaincontext.
-->
--commentfollowingifstruts1.0.x-->
--ÅäÖÃTitles²å¼þ-->
--ÅäÖÃvalidator²å¼þ-->
=======================================================================
struts2¿ò¼Ü:
ÏÂÔØ×îа汾Struts2.5.2(Ò»°ãÏÂÔØËùÐèÒªµÄlib°ü¼´¿É),н¨DynamicWebProjectÏîÄ¿(×¢ÒâÒª½«Defaultoutputfolder¸ÄΪWebContent/classes£¬ÇÒѡΪ×Ô¶¯Éú³Éweb.xmlÎļþ)£¬½«ÏÂÔصÄStruts2/apps/struts2-bank/libϵÄjarÎļþ¸´ÖƵ½ÏîĿϵÄWebContent/WEB-INF/libÏ£¬
Ö®ºó½«Struts2/apps/struts2-bankʾÀýÎļþÖÐweb.xmlÖеÄfilter±êÇ©¡¢filter-mapping±êÇ©µÄÄÚÈÝcopyµ½ÏîÄ¿µÄweb.xmlÎļþÖУ¬²¢½«Struts2/apps/struts2-bankʾÀýÎļþÖеÄstruts.xml¸´ÖƵ½ÏîÄ¿µÄsrcĿ¼Ï¡£
·ÃÎÊWEBÔªËصÄËÄÖÖ·½·¨£º
//È¡µÃMapÀàÐÍ£ºrequest£¬session£¬application£¨µÚÒ»£¬¶þÖÖ·½·¨£©
//È¡µÃhttpÀïµÄÌØÊâ·½·¨£ºHttpServletRequest,HttpSession,ServletContext£¨µÚÈý£¬ËÄÖÖ·½·¨£©
µÚÒ»ÖÖ£º£¨ÒýÓÃActionContextÀࣩ
publicclassLoginActionextendsActionSupport{
privateMaprequest;
privateMapsession;//³£³£»ñÈ¡session
privateMapapplication;
publicLoginAction(){
request=(Map)ActionContext.getContext.get(“request”);
session=(Map)ActionContext.getContext.get(“session”);
application=(Map)ActionContext.getContext.