STRUTS2 Part Label

Source: Internet
Author: User

Since struts uses OGNL language, it is necessary to introduce <% @taglib prefix= "s" uri= "/struts-tags" before using the class tag%>

1.form (form) label

Form labels are primarily used to generate form elements, which are the most special labels in all UI components, and other UI components that interact with the server must be placed within the form tag.

<s:form name= "Form1" action= "the name of the action to be submitted" method= "method submitted (Get/post) theme=" View template validate= "client-side validation" ></S: Form>

2.textfield Label

TextField tags are mainly used to enter a small paragraph of text such as name, etc.

<s:textfield name= "size=" Field size "id=" to identify the element ID "maxlength=" Maximum length ></s:textfield>

3.password Label

The password tag is the same as the TextField tag, but the password tag does not display the input in the default state, but it can also set the value of the Showpassword to be displayed.

<s:password showpassword= "Whether to display the maximum length of the input maxlength= field" readonly= "the size of the read-only property size= field" ></s:password>

4.checkbox Label checkbox tag represents a check box

<s:checkbox name= "" fieldvalue= "basketball" > Basketball </s:checkbox>

<s:checkbox name= "" fieldvalue= "painting" > Painting </s:checkbox>

<s:checkbox name= "" Fieldvalue= "Tour" > Travel </s:checkbox>

<s:checkbox name= "" fieldvalue= "calligraphy" > Calligraphy </s:checkbox>

5.checkboxlist Label

Checkbooklist and check labels are similar but can define multiple checkbox at a time check box

<s:checkboxlist name="" list= "{' Language ', ' math ', ' English ', ' Sports '} ' ></s:checkboxlist>

6.interator Label

Interator tags are used to iterate over a collection container or enumeration value

<s:iterator value="{' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 '}" id=' number ' >

<s:property value=' number '/>a


It prints the result as: 1a2a3a4a5a Label

The property tag is the attribute value used to get the Ognlcontext context, also known as the data label

<s:property value= "Property value"/>

8.if else语句的使用

     < s:set name = "age" value = "21" /> < s:if test = "#age==23" >      23 </ s:if > < s:elseif test = "#age==21" >      21 </ s:elseif > < s:else >      都不等 </ s:else >This article only describes the use of some of the struts2 important tags, where some of the label properties are not written to write exactly the important attributes. for more detailed label usage please refer to

STRUTS2 Part Label

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: 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.