JSP related null and double quotes how to judge?

Source: Internet
Author: User

For example: String name = Request.getparameter ("name");

If the client incoming page has no accessible control with name, the obtained name value is null; If the client incoming page has a accessible control with name, but no value entered, the name value is "";

So you have to judge. <input type= "text" name= "name" value= "<%=request.getparameter (" name ") ==null?": Request.getparameter ("name") %> "/> (index.jsp)

The server-side code is as follows:

String name=request.getparameter ("Name11");

String password=request.getparameter ("password");

if (name==null) {out.println ("empty null"); }

if ("". Equals (name)) {OUT.PRINTLN ("null for double quotes"); }

The server request (index.jsp) This page, he has not submitted the form, that is, the service does not confiscate the value passed in the name parameter, so at this time should conform to if (name==null) {out.println ("null"); } This condition, so value= "<%=request.getparameter (" name ") ==null?": Request.getparameter ("name")%> "the judgment is correct.

JSP related null and double quotes how to judge?

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.