Java basics --- Servlet listener, basics --- servlet
Before writing this article, read the school friends write, I feel the basic knowledge of induction is very comprehensive, I am not cumbersome to write here, link address (http://www.cnblogs.com/sherryueda/p/4273169.html ),
I will write down the specific application of the listener:
The function is used to listen to various WEB operations. When an event i
[Servlet JSP] From JSP to Servlet
JSP and Servlet are both sides of the Integration. JSP will eventually be translated into Servlet Source Code by containers, automatically compiled into. class files, loaded into. class files, and then generated Servlet objects.
The
How to develop a servlet
The mapping path of the servlet
servlet Default Path
The life cycle of Sevlet
Automatic loading of Servlets
The Init method with parameters and the Init method without parameters
Multithreading concurrency problems for servlets
ServletConfig Object
ServletContext Object
4. The life cycle of the servlet
The servlet summarizes the main interfaces, classes, and 01--servlet(i) Servlet classThe structure of the Servlet main class and interface is as follows:To write a servlet requires implementing the Javax.servlet.Servlet interface, which defines 5 methods. As follows:1.init (
Chapter 2 The servlet InterfaceChapter 2 servlet InterfaceThe servlet interface is the central reserved action of the Java Servlet API. All servletsServlet interface is the core abstract interface of Java Servlet API.Implement this interface either directly, or more commonly
First we have to understand the lifecycle of the servlet:
The server creates only a single instance of each servlet, and its Init method is invoked the first time the servlet is created, so Init is where the one-time setup code is placed, and then a thread is created for each user's request, which calls the instance method that was created earlier. Multiple concu
servlet Development Details-thread safetyWhen multiple clients access the same servlet concurrently, the Web server creates a thread for each client's access request and invokes the Servlet's service method on that thread, so if a resource is accessed within the service method, It is possible to raise a thread safety issue.The use of synchronization blocks can resolve thread safety issues, but will cause co
SRV.3.1 ServletContext Interface Description
The ServletContext interface defines servlet-related view information in the web application running servlet. The container provider is responsible for providing a specific set of implementations of ServletContext. Through the ServletContext object, servlet can record events, obtain resource references, and set and sav
HTML call servlet (1), html call servlet1. Data forms on the page
Before using Servlet to process user requests, prepare a page to provide data forms. The data form is the
Add.html
2. Add data
One of the advantages of Servlet is that it can easily obtain data in the form. Add the following code using JDBC technology in Servl
Servlet filter, servlet
I,FilterIntroduction and use
What is a filter?
Similar to Servlet, a filter is a web application component that can be bound to a web application. However, unlike other web application components, filters are "Links" in container processing. This means that they will access an incoming request before the
1. SummaryIn native Servlet development, if a URL corresponds to a servlet-mapping, then Web. XML will be very lengthy and difficult to maintain. In fact, we can actually use Filter + reflection to make a servlet handle multiple URLs and invoke different methods in the servlet based on different URLs (similar to SPRING
servlet development standards, the servlet has its own small framework, a standard servlet program to have a complete lifecycle, what is the lifecycle? Let's take a look at the standard servlet development.
Servlet life cycle
Lifecycle is the cycle of a program's existence
Basic knowledge Review Chapter 1 servlet learning and understanding, Chapter 1 servlet
As for servlet, I believe that I have learned java, and I have recently sorted out the basic knowledge so that I can better understand ssm or ssh. Next I will start from1: Servlet Interface
Servl
Three ways to develop a servlet:
Implementing a Servlet interface
Inherit Generic Servlet
Inherit HttpServlet
Requirements: By inheriting the servlet interface, develop a servlet that requires the Hello,world to be displayed. The current time is also displayed.
Steps:
1: S
Detailed process of converting JSP into Servlet, and converting jsp into servlet
Many people think that the execution performance of JSP is much different from that of Servlet. In fact, the difference in execution performance is only the first execution. This is because after the first execution of JSP, it will be compiled into a
Jsp + servlet for file upload and download, servlet File Upload
This article provides examples of the Code for uploading and downloading jsp servlet files for your reference. The details are as follows:
Upload:
Need to import two packages: commons-fileupload-1.2.1.jar, commons-io-1.4.jar
Import java. io. file; import java. io. IOException; import java. util. list
Servlet and cache (4), servlet Cache1. Set two cache conditions:First, you can set a reasonable Cache Time Value for infrequently changed data in the servlet to avoid frequent requests sent by the browser to the server and improve the server performance.
Type 2: If you want to implement an advanced function, that is, when the client requests dynamic web resources
Web Access name of the servletThe Web access name of a servlet can be more than one, and in addition to the XML configuration, it can also be configured using annotations, now the main configuration is to use annotations, which is the Servlet3.0 feature, the annotations are configured to be lighter and simpler than web. XML, But do not rule out some old projects still use the configuration of Web. Xml.Here's a look at using the * wildcard on annotatio
Servlet| Notes
The lifecycle of the servlet is generally:
1. Create an initialization servlet
2. Handle 0 or more requests from the client
3. Destroy SERVLET,GC Reclaim memory
Each server may have a different approach to how it supports the servlet, but the
Servlet @ WebServlet annotation, servlet @ webservletServlet @ WebServlet Annotation
After compiling the Servlet, you need to tell the Web Container some information about the Servlet.
In Servlet3.0, you can use Annotation to tell the container which servlets will provide services and additional information.
Write an
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.