[6] Learn Struts and Form-related labels

xiaoxiao2021-03-06  102

Continue to learn the HTML tag library provided by Struts.

BY Budi Kurniawan

In the first part of this series, I tells how to use the HTML tag library provided by Struts to configure a Struts application. I also introduced a class of labels in the label library: a label that uses independently. In the second part I will continue to introduce the second type of label: Tags related to Form.

Tags related to the Form include the

tag itself, and all the labels that must be included there. For example, the and tags are related to Form, because if they don't put them in a form, they don't make sense.

Tags tag is used to generate an HTML Form. Many rules must be followed when using this tag.

First, an action property must be included in the tag, which is the only necessary attribute in this tab. If this property does not have this attribute, the JSP page will throw an exception. You must give this Action property to a valid value. A valid value refers to the access path of any child element in the element in the application's Struts configuration file. Moreover, there must be a Name property in the corresponding element, which is the name of the Form Bean.

For example, if you have such a tag:

Then there must be a element that is displayed as a bold in the element of your Struts profile:

TYPE = "com.javapro.struts.loginaction"

Name = "loginform"

Scope = "request"

INPUT = "/ login.jsp">

.

.

.

That is to say that a FORM tag is associated with form beans.

Another rule to follow is: any label (, , ,