The relative path of files in Web applications starts from the F:/yangxp/tools/Apache-Tomcat-5.5.12/bin directory.
F:/yangxp/tools/Apache-Tomcat-5.5.12/bin
F:/yangxp/tools/Apache-Tomcat-5.5.12/webapps/showusercount/WEB-INF/classes
="
../Webapps/showusercount/WEB-INF/classes
Interface problems:
All methods in the interface must be implemented, even if it is empty. Leading to many invalid redundancy operations
Solution:
Implemented by a third party according to the interface, all of which are empty
Publish the implementation class to the user. Users only need to overwrite the methods they are interested in.
----- Adapter mode (*** adapter)
General Resource (220 V) ---- adapter ----> applicable to current electrical voltage
Servlet interface servletconfig Interface
|
Genericservlet (Abstract adapter class)
| Servletcontext getservletcontext ()
| Obtain the context of the current processing class (current Web Application)
|
Httpservlet (generic implementation Class Based on HTTP Protocol)
| Void Service (servletrequest req, servletresponse res)
The Web Container directly forwards requests and responses to the following methods.
| Protected void Service (httpservletrequest req, httpservletresponse resp)
[Programmers can override this method and write service processes]
This method automatically submits forms based on the client,
Forward requests and responses to the method corresponding to the submission method
For example, if form is submitted in get mode, it is called:
| Protected void doget (httpservletrequest req, httpservletresponse resp)
[We recommend that programmers overwrite doget & dopost]
Myservlet
Servlet interface: mainly defines the servlet lifecycle Method
Servletconfig interface: defines servlet methods for obtaining information transmitted by external containers (Web. XML)
Genericservlet implementation class: implements the methods of the above two interfaces, and adds the log record Method
Httpservlet: Generic implementation Class Based on HTTP protocol
Http: // localhost: 8088/stumgmt/add.html
Http: // localhost: 8088/stumgmt/addstudent? Name = Heihei & Birthday = 1989-3-3
Relative Path: relative to the current path
HTML: absolute path, starting from 8088