Summary of data types submitted to the background by a blank form (Java)

Source: Internet
Author: User

When the form is submitted to the server, the server's servlet obtains the request parameters through the Getparamater () method. But notice what time, Request.getparatemeter (name) uses name to refer to the name of the parameter being submitted:

(1) A blank form is submitted, only text of the type will send the request parameters, and Radio,checkout and select and other types will not send the request parameters, that is, there is no key=value this type,

(2) Call Getparamater (name) on this side of the servlet, if the request parameter does not contain name, then the resulting null

(3) If the request parameter contains, but does not fill in the content, then the resulting empty string ""

(4) in the background to make a non-null judgment need to judge two situations so generally written: set the value of values

if (Value!=null &&!value.trim (). IsEmpty ())

The preceding is a non-null judgment

The following is a string that may contain more than one space, so you need to cut the space before and after the empty string call IsEmpty () method returns True

Summary of data types submitted to the background by a blank form (Java)

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.