Thursday, October 14, 2010

Servlet's Context and Config



For the web container is, Servlet Context Servlet interface defines a context object, this object defines a Servlet Servlet engine on the view. By using this object, Servlet can log events, obtain resources and get the engine from the Servlet class.

Servlet container is loaded at startup web applications and web applications for each Servlet context to create a unique object, could Servlet Context as a Web application server-side component of shared memory, can be stored in the Servlet Context share data, he provides four read and set the shared data. See in particular api help file.

In addition, Servlet Context object only in the web application is closed macro will only destroy, different web applications, Servlet Context independent existence.

A web application from the jsp, Servlet, javabean constitute such a collection of web components, each web application, the container will have a background object, while the javax.Servlet.Servlet Context interfaces provide a way to access the background object. You can be a Servlet examples getServlet Context () method to run them by the Servlet objects in this background, the background object from this you can access the following information resources:

1. Initialization parameters

2. Stored objects in the background

3. The resources associated with the background

4. Log

Finally, Servlet Context is my own conclusion:

Servlet Context Servlet container that is, their method can provide the same Servlet web applications were all under the use of, and for the config object, he is compared with the context, there is a lot of limitations.

When the Servlet Config object in the Servlet has been instantiated for any client to access at any time effective. But a Servlet to Servlet Config object can not be another Servlet access, that is, after a statement in the Servlet Servlet Config can only be accessed within the Servlet, are durable and effective internal variables.

Under one case, for a deep understanding of:

In general, the configuration of the entire application, in order not to use "hard coding" should be configured as Servlet Context parameter, such as character set settings.

................. CharsetGB2312 .................

Note that the above format is only 2.0 standard format after the old container (engine) with service providers own configuration format. Note that it's parent element should be that it is the role of an application.

If only a specific set of parameters Servlet to other Servlet can not be shared, it should be configured as Servlet Config parameters, such as a Servlet to read attachment to the absolute directory to use, while the other Servlet will not be used:

GetAttmail.GetAttServletabsPath / usr / mail / ax / axman / Maildir /

Needless to say, because the label has been specified name and class, this means that only mail.GetAttServlet
Servlet in order to get to the path, while others can not get to the Servlet.

Even before we talk about the attributes of this understanding, let's learn together about how to obtain the parameters of the two objects:

Access Servlet Config parameters:

First of all, to get Servlet Config object, then call it the getInitParameter (); method. To access the Servlet Config object, jsp config directly using built-in objects, but because of your JSP Servlet compiled in general will not be added to the web.xml, so generally not through jsp to take on the JSP compiled Servlet configuration parameters, then the Servlet to get Servlet Config object in two ways:

In inii () method to take to: overloaded method of passing through init

..... Public class Test extends HttpServlet (ServletConfig config; public void init (ServletConfig config) throws ServletException (this.config = config;) ..................)

Then in the following ways to access config object. But to note that in order to ensure construction methods from the config object to the current Servlet should call the parent class constructor:

..... Public class Test extends HttpServlet (ServletConfig config; public void init (ServletConfig config) throws ServletException (super.init (config); this.config = config;) ............ ......)

By getServlet Config () method directly to, the benefits of doing so is not mixing manual transmission properties, can at any time

To obtain.

A third method, it has to implement some interface, not here presented as a general discussion.

To access the Servlet Context object, as long as from the existing Servlet Config object getServlet Context () on it, and then
Call it the getInitParameter () method can access its parameters.

Ordinarily: Servlet Context Servlet Config object scope than the scope, why to get from the Servlet Config in the Servlet Context object? I personally think: container preservation for many Servlet Context object, a request which the container in the end take
To you? It contains Servlet Config take that information to you, that take Servlet Config object's parent object. As if the same HttpSession obtained from requset is taking the request object contains the current session object to you, this is only my personal idea, not had time to look at implementation. Anyway, so use it on.







Recommended links:



XviD to MP4



DOS, also use flash tips



"Nobunaga's Ambition 12 innovations," Ida 55 Owari family reunification tragic history



B2C in China's "money" King



Wizard Vertical Market Apps



Second-hand Computers Xi'an China Merchants Plaza, more than 60 illegal businesses operating wit



M2TS to MKV



PC giant brewing group prices: Three reasons support



Golden Abacus settled in Wuhan air "Gold Dealer"



reviews Audio RECORDERS



MKV to Zune



COSTIND speed up the ESTABLISHMENT of a modern shipbuilding mode guidance



sql server 2000 in data synchronization



Directory Audio CD Burners



Monday, October 11, 2010

Farewell babyface, iSee 1 minute to create face-lift effect



1. Start face-lift. Than the first face-lift and fat part of the Department.
iSee Open Figure 1. Select "on the right sidebar" - Portrait beauty - large eyes.


Figure 1

Into the "large eyes" processing interface, select "Zoom document."

Written Size: 27 (written transferred to the appropriate size)

Zoom strength: -32 (to enlarge the intensity to a lower negative)


Figure 2

Part of the circle center near the face-lift inside, click the left mouse button, you can face-up. Proposed to image zoom, can be fine-tuning.

2. Then a little face-lift and fat part of the Department.

Written Size: 27

Zoom strength: -18 (the face-weakened)


Figure 3

Click the left mouse button, the circle center section near the face-lift inside and curvature along the contours of the face to the MM face-lift. This effect is more natural face-lift. Only a minute, babyface really gone. Keep the thin face small V. And dermabrasion whitening look, plus a lovely graffiti, the effect is even more perfect.


Figure 4







Recommended links:



Young professionals entering the workplace to learn the three key issues



How To Identify Real And Can Automatically Create Index Index



Pao GS-816FC Fiber Disk Array



AVI to 3GP



Neusoft interpretation of "child swallow mother" listed as a whole integration scheme



Approach new and SUCCESSFUL



AVI to FLV



[OTHER] Project2000 thematic knowledge (4)



Easy HOBBY



for you GAMES Sports



Matroska to MP4



Desktop Directory



Bitmap image synthesis MODEL and channel together



Tencent intensified defendant WHO copied the crime portal



LG 42pc5dc 42 inch plasma tv review



Essays on CMMI [1]