Servlet knowledge point summary (JSP), servlet knowledge point

Source: Internet
Author: User

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 ");

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.