JSP from simple to deep (12) — form editing

For example, the flag library from the blazix server cannot be used in your system environment, so what about not using the flag library to achieve similar functions? This tutorial is designed to solve this problem. This problem can be solved, but the code should be longer. Basically, you have to edit the HTML flag yourself and set it to the default value. From the example below, we can learn how to modify getname JSP to provide features similar to BLX: getproperty, but we can only edit the HTML flag manually:

What's your name? < INPUT TYPE=TEXT NAME=username

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

What's your e-mail address? < INPUT TYPE=TEXT

NAME=email SIZE=20

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

What's your age? < INPUT TYPE=TEXT NAME=age

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

As shown in the above code, it simply adds a "value" field to the input flag and initializes the field with an expression.

In order to handle the abnormal errors in the input process, we can use the "string" area in the bean and convert it to the target data type. So you can also handle exception errors.

As an after class exercise, we can change the example in the previous tutorial to not use the blazix logo library.

So far, this "JSP from simple to deep" series of tutorials is over. I hope it will be helpful to you.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>