Servlet knowledge point summary (JSP), servlet knowledge point
I,
Servlet is a class. servlet and JSP are available first. servlet is mainly used for logic processing before page Jump.
Method 1 for writing the first servlet manually. inherit from httpservlet 2 and override doget dopost method 3. register the servlet in web. xml.
You can simply create a new servlet!
II.
Generally, a hyperlink is a get transmission method.
3.
The following operations are performed during dopost/get processing of transmitted information:
// Prevent garbled characters
Response. setContentType ("text/css; charset = UTF-8 ");
Request. setCharacterEncoding ("UTF-8 ");
Response. setCharacterEncoding ("UTF-8 ");
// Obtain the data drama submitted on the JSP page. For example
String name = request. getParameter ("name ");
People p = new People ();
P. setName (name); // set for encapsulation
// Create add, delete, modify, and query objects, and add information to the database
Lelecrud pc = new Peoplecrud ();
Pc. add (p );
// Jump to the page
Response. sendRedirect ("sucessful. jsp ");