Created: 6.15
1. What is Servlet
Servlet running on the server side Java applets, is sun offers a set of specifications (interfaces) for handling client requests, dynamic resource response to the browser. But the essence is the java servlet code output by the client API java dynamic content
servlet specification: Technical comprises three points
1) servlet technology
2) filter technology filter ---
3) listener listener technology ---
* Housewives: Publish Project
- Create dynamic WEB project
- Option version 2.5 (support before Eclipse 8+)
- Next, the hook is automatically selected to generate web.xml, finish
- Writing project. . . . . .
- After writing, publishing project
- Eclipse jump out of 404 do not control, because it will look for the default index file in the web project, to test whether the browser successfully posted
Enter http: // localhost: tomcat port number / project name + virtual path
The console displays the contents
2. Servlet Getting Started
Implementation steps:
1) Create a class that implements the Servlet interface
Method 2) to cover unrealized --- Key: service method
2) is arranged in the servlet web.xml
* <Servlet-name> name here easily take </ servlet-name>, but the yellow portion of the two must be equal to the name!
* <Servlet-class> Here is the full name of the class </ servlet-class>
Get square one:
Fang II:
* <Url-pattern> virtual path to / Start </ url-pattern>
But in the actual development, we will not go directly to implement the Servlet interface, because too many methods that need to be covered, we generally create a class inherited HttpServlet