JSP (12)

Source: Internet
Author: User

For example, the flag library from the Blazix server cannot be used in your system environment, so do not use the flag library to implement similar functions? This tutorial is for this question. This problem can be solved, but the code is longer. Basically, you must edit the HTML flag and set the default value. In the example below, we can learn how to modify GetName. jsp to provide features similar to blx: getProperty, but we can only manually edit the HTML flag:

<Jsp: useBean id = "user" class = "UserData" scope = "session"/>

<HTML>


<BODY>


<Form method = post action = "SaveName. jsp">


Whats your name? <Input type = text name = username


SIZE = 20 VALUE = "<% = user. getUsername () %>"> <BR>


Whats your e-mail address? <Input type = TEXT


NAME = email SIZE = 20


VALUE = "<% = user. getEmail () %>"> <BR>


Whats your age? <Input type = text name = age


SIZE = 4 VALUE = <% = user. getAge () %>


<P> <input type = SUBMIT>


</FORM>


</BODY>


</HTML>



As shown in the code above, it simply adds a "VALUE" area on the INPUT flag and uses an expression to initialize this area.

To handle exception errors during input, we can use the "String" Area in bean and convert it to the target data type. Therefore, exception errors can also be handled.

As an after-school exercise, we can change the example in the previous tutorial to a non-Blazix flag library.


At this point, the "JSP from simple to deep" series of tutorials have all ended, and I hope to help you.

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.