《JSPImplicitObjects》由会员分享,可在线阅读,更多相关《JSPImplicitObjects(52页珍藏版)》请在金锄头文库上搜索。
1、戛Content。1.ScopeofSPobjects。2.ImplicitObjects。3,AnSPObjectApplicationExample&4.ExpressionLanguage(EL)2Bhy学1.ScopeofSPObjects3Bh9喜DefinitiononScopeofSPObjectsTheavailabilityofaSPobjectforusefromaparticularplaceoftheapplicationisdefinedasthescopeofthatSP0bject.2Bh9喜KindsObjectscopeinSPissegregatedinto
2、fourpartsaccordingtotheiravailablerangandlifetime。Pacescope。RedquestScope。SessionscopeApplicationscope21os5薯Pagescope。TheSPobjectcanbeaccessedonlyfromwithinthesamepagewhereitwascreated.Thedefaultscopefor3SP-objectscreatedusingtagispage.SPimplicitobjectsout,exception,response,config,pageContext,andpa
3、gehave“pagescope.2Bh9喜RequestscopeAJSPobjectcreatedusingtherequestscopecanbeaccessedfromanypagesthatservesthatrequest.。TheSPobjectwillbeboundtotherequestobject.。Implicitobjectrequesthastherequestscope:.2Bh9喜SessionscopetheSPobjectisaccessiblefrompagesthatbelongtothesamesessionfromwhereitwascreated.。
4、TheJSPobjectthatiscreatedusingthesessionScopeisboundtothesessionobject.。ImplicitobjectsessionhastheSessionscope.2Bh9薯ApplicationscopeAJSPobjectcreatedusingtheapplicationscopecanbeaccessedfromanypagesacrosstheapplication.。TheJSPobjectisboundtotheapplicationobject.。Implicitobjectapplicationhasthe“appl
5、icationScope.2Bh9OperationonAttributesributeoperationmethodAnnotationpublicvoidsetAttribute(stringnameObjectob)Setthe“namerasthereferenceoftheobjectvob“publicObjectgetAttribute(Stringname)GetthevalueofattributenamepublicvoidremoveAtribute(StringnameRemovetheattributenamepublicEnumersticngeiAitibutel
6、tamis01GetaltheatineutsswithintheavailebleccopepublicObjectgetAttribute(Stringnameintscope)publicvoidsetAttribute(stringnameObjectobjectintscope)publicvoidremoveAtribute(stringnameyintscopepublicEnumerationgetAtributeNamesInscopefintscope)SpecialmethodforPageContextUsedteaccessatribute“namerwithinscope“scope“.2Bh910学“2.ImplicitObiects3Bh9