There are three kinds of attributes in the servlet api.they are seperated ServletContext attribute,ServletRequest attribute and httpsession attribute.they have different accessibility,scope and usage.as follows are they.
First of all,we talk the ServletContext attribute ,any part of the web app could acess it,and its life is the web app's deployed life,only the server or the app goes down,the context could be destroyed,of course,including the attribute in the servletContext.
as for its usage,it can be used to store the resources which you
are intent to share in the entire app,for example,the JNDI lookup names,email address ,etc.In addition,we must be aware of ServletContext attribute being not thread safe. and we always synchronized the ServletContext,instead of synchronized the service method.
Secondly,we step into the HttpSession .it can be asessed by any servlets or jsp which are related with the session.and as to the lifecircle,the session can be destroyed programaticallily,or time out.the session attribute can be used to store the resources which is related to the client's session.what'more,it also is not thread safe.so we also need to control the acess to it.we often synchronized the session..
Finally,we are going to talk the last Request attribute.it can be acessed by any part of app which has a direct access to the request.the request object is destroyed after the service method completes.it can be used to pass the model info from controller to
views.
分享到:
相关推荐
Predicting face attributes in the wild is challenging due to complex face variations. We propose a novel deep learning framework for attribute prediction in the wild. It cascades two CNNs, LNet and ...
On the handling of Continuous-valued attributes in decisiontree generation
Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. DIGEST_AUTH - Static variable in interface javax.servlet.http.HttpServletRequest String ...
Characterization of polarization attributes of seismic waves using continuous wavelet transforms
Attributes are used to modify the runtime behavior of code in the .NET Framework. Applied .NET Attributes explores the application of .NET attributes and how developers can write custom attributes ...
Quality of Service Attributes for Diameter
The role of live streaming in building consumer trust and engagement with social commerce sellers
Which of the following is true about attributes in a relational model? Attributes can be multi-valued. Attributes can be composite. (a) Both I and II (b) II only (c) Neither I nor II (d) I ...
The three color attributes in the In-CAM(CIELUV) space are mutually independent. This is a very convenient feature for selecting color combinations. Some two-color combinations selected systematically...
Attributes of Effective Leader-Negotiators.pdf
ISO-TR 8550-2:2007 Guidance on the selection and usage of acceptance sampling systems for inspection of discrete items in lots - Part 2:Sampling by attributes - 完整英文版(19页).pdf
The authors develop a model that includes a map data type capable of representing thematic and geometric attributes in a single data object. The book provides a complete example of mathematically ...
在分类及预测任务中对高维类别(category)变量的预处理方法
Fundamentals of Power Semiconductor Devices provides an in-depth treatment of the physics of operation of power semiconductor devices that are commonly used by the power electronics industry....
Since the number of attributes in any database is always finite, we focus on our fundamentally theoretical discussion of nonadditive set function and nonlinear integrals, which are presented in the ...
RADIUS Attributes
commons-attributes-2.2.zipcommons-attributes-2.2.zipcommons-attributes-2.2.zipcommons-attributes-2.2.zipcommons-attributes-2.2.zipcommons-attributes-2.2.zip
Attributes结构的一个总结,适合java开发者使用。
Both lower and upper approximations of a concept will change dynamically when attributes vary. Inspired by the former incremental algorithm in Pawlak rough sets, this paper focuses on new strategies ...
Laravel开发-attributes Rinvex属性是一种健壮、智能和集成的实体属性值模型(EAV)实现,用于Laravel雄辩,具有强大的底层功能,可以轻松地将实体属性隐式管理为关系。它利用了Laravel雄辩的力量,平滑无缝的集成。