(ServletContext, HttpS ... ) is exactly the same as the property APIFor enumeration, see Java-enumeration Summary by IAMTJW5, the bad side of the property. •. ```.. ``.. `.`.`...`..
Context properties are not thread safe! A context property may be changed and accessed by multiple servlets at the same time. The bad solution is to add synchronized to doget (or other methods), which does not solve th
particular protocol to handle the secure transmission. (The HTTPS protocol on top of SSL is practically always used.) )Data protection has some overhead and does not encrypt every request and response in your app, so use--conservatively and declaratively--to achieve data confidentiality and integrity:Data protection
Unauthenticated customer requests a restricted resource without a transmission guarantee
An unauthenticated customer requests a restricted resource, which is guaranteed
("); org.apache.jasper.runtime.JspRuntimeLibrary.include (Request, response, "footer.jsp", out, false ); Out.write ( "\ n"); Out.write ("\ n"); Out.write ("The bold distinction is the conversion code for the include directive and the include action.Param actionModify the index.jsp code above:Modify Footer.jspEffectFoward ActionGarbled problem is not resolved, can only input Chinese. (Request.getparameter ("UserName")null) {% > page= "handleit.jsp"/> %}% > handl
1, El's English is expression Language, translated into Chinese is "expression language." This is a scripting language for front-end programmers, and El does not have a "big difference" compared to Java expressions, and it seems somewhat "superfluous" to the backend programmer.2, however, We can not force every front-end programmer to learn Java,el compared to java
configuration in
Assigning values to Objects
Provided ServletConfig when the servlet was first initialized
Provided ServletContext when the servlet was first initialized
To initialize the parameters Servletcontextlistener (Context Listener)Servletcontextlistener is able to listen to a context initialization event so that it can get context parameters and run some code before the app provides services to the customer.Just as you tell the Web container
Servlets and jsp (preferred for SUN Enterprise Applications) Development Principles (II)
Do not re-invent the wheel. Do not start from scratch: Custom components can improve reusability, but custom components still need to write, test, and Debug programs. The problem is that someone else may have done this, and your implementation method is not necessarily better than others. This isJsp (prefer
unconsciously mix the presentation layer and business layer. Just like the previous friend who put the database processing information in JSP, in fact, it should be placed in the business layer.
According to SUN's recommendation, JSP should only store the content related to the presentation layer, that is, only the part of the HTML webpage is output. All data computing, data analysis, and database connecti
).
What are the implied objects (Implicity object) in the JSP page? What are their respective types and functions?
Request--
Reponse--
Session--
Application--
Out--
Page--
PageContext--
Exception-valid only if the current JSP page is the error page.
Config--
What is the difference between the
servlets/
client. Resp),doPost (httpservletrequest req, HttpServletResponse resp) such as
The servlet responds to the customer by responding to the object, and the container returns the response to the customer.
The service () thread ends, retains or cleans up the responding object, and the customer gets a response.
3. Mark Tomcat Official document Servlet API documentation4, HttpServlet inheritance tree, interface
Java.lang.Object
Javax.servlet.GenericServletJavax.servlet.http
Servlet and JSP Technology is the Java Development Server-side application of the main technology, is the development of business applications, the standard of the presentation end. Java developers like to use it for a variety of reasons, one is familiar with the Java language developers are easy to learn the technolog
Java ServletTechnology andJSP TechnologyWith the Java server technology, they currently control the entire server-side Java technology market and gradually become the standard for building commercial Web applications. Java developers like these technologies for many reasons, including: these technologies are easy to le
Let other components take over all requests; Partial takeover requestSome questions--The Intercept point is useful.1. Let other components take over all requests. PackageCom.example.web;ImportCom.example.model.BeerExpert;Importjavax.servlet.*;Importjavax.servlet.http.*;ImportJava.io.*;ImportJava.util.*; Public classBeerselectextendsHttpServlet {@Overrideprotected voidDoPost (httpservletrequest req, HttpServletResponse resp)throwsservletexception, IOException {String C= Req.getparameter ("Color")
First of all, spit groove yourself, old remember the wrong spelling of the word servlets ~ ~ ~At head first Servlets jsp, I felt the fascination of head first (multi-image, one-page-less, this is head).What did the 1.WEB server do for you?Web browser----(the user's request contains the name and address URL of the resource the user is looking for)---> RequestServe
Declaring a generic error pageThis applies to all resources in the Web app, not just the JSP
A more explicit exception error declaration
Declaring error page based on HTTP status code
Configuring servlet initialization in DDThe servlet is initialized by default when the first request arrives, and you can set the Load-on-startup element if you want to load the servlet when the deployment or server restarts.If multiple elements ar
is not serializable? For migration, the Property object class needs to be httpsessionactivationlistener and the activation/deactivation callback method is used to solve the problem.
Listener Example
Session counterThis listener allows you to track the number of active sessions in this web app:To configure listeners in DD:Attention:
Attribute Supervisor ListenerThis listener can be traced every time a property is added to a session, a property is deleted, or a property is repla
type first, and then change to another type to continue writing.6. Why should I return a file through a servlet instead of returning it directly? The reason is that you want to perform some logic before and after returning a specific type of file, such as determining whether the user has permission to download the file.7, some things to remember, about the output, there are only two choices: characters or bytes.Output streams that can be returned via resp ... /* Omit parameter */ // can
Cookie ("userid", UserID); Resp.addcookie (cookie);Once the cookie is sent from the server side to the client, there is no way for the server side to display the cookie deletion. However, a substantial deletion of the client cookie can be achieved by overwriting the expired cookie.New Cookie ("userid", UserID), Cookie.setmaxage (0); Resp.addcookie (cookie) ;Chinese charactersIf the contents of a cookie are Chinese characters, you need to encode it:String username = java.net.URLEncoder.encode ("
shown below (click to view larger image):Click on the network, you can observe a header named Loction, the content is exactly the URL we redirect, then if the servlet code is changed to "Resp.setheader (" Location "," http://www.cnblogs.com/xkxf/"); Can I implement redirection? The answer is no, but add the words "resp.setstatus (302);" It is possible to achieve this effect.7. Finally, what does Sendredirect ("another URL") mean? The explanation in the book is that you want the browser to proce
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.