JSP from simple to deep (11-3)

Source: Internet
Author: User

If you are careful, you can also find that there is still a problem in the form, that is, "age" starts to show blank rather than 0. To solve this problem, we can add "emptyInt = 0" to the blx: getProperty and blx: setProperty flag, so that the bean region is initialized to 0. If the entered age is not a valid value, 0 is used to indicate null characters.

Another small problem is that if an error occurs and our old book contains "GetName. jsp", we will get two "<HTML>" marks. A perfect solution to this problem is to remove out. println and pass the error as follows:

<%

If (haveError ){

Request. setAttribute ("errors ",

Errors. toString ());

PageContext. forward ("GetName. jsp ");

} Else

PageContext. forward ("NextPage. jsp ");

%>

You can run "request. getAttribute" in GetName. jsp. If the returned value is not null, an error is displayed. Keep this exercise as part of this tutorial.

Finally, let's talk about the exercises in this section first. Read the SQL mark in the mark library document and create a database table. Then write a JSP file with a FORM and a selection box on the FORM; then, use the SQL flag to create a selection box based on the database table.

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.