In struts2, theme attributes include XHTML, HTML, simple, and Ajax. The default is XHTML.
Theme: Set the topic of the struts2 tag. The default value is XHTML. When theme = XHTML: Additional Tr and TD are generated by default. Theme = simple: generate the HTML tag format corresponding to the tag.
By default, form elements are distributed across different rows. The following code:
<S: Form Action = "login2"> <s: textfield label = "username" name = "username"/> <s: password label = "password" name = "password"/> <s: Submit label = "Submit"/> </S: Form>
We can see that the above Code is not much different from HTML, but because the struts2 form divides every element in the form into a single row by default, the label attribute is the same as the text label before <input type = "text"/> in HTML. If we don't want it to wrap automatically, we should write it in the following format:
<S: Form Action = "login2"Theme = "simple"> <S: textfield label = "username" name = "username"/> <s: Password label = "password" name = "password"/> <s: submit label = "Submit"/> </S: Form>
HoweverTheme = "simple"The label attribute of the form element is invalid. In this case, you must add the text you want to display with the label before the form element. For example:
<S: Form Action = "login2"Theme = "simple"> Username: <s: textfield label = "username" name = "username"/> password: <s: Password label = "password" name = "password"/> <s: submit label = "Submit"/> </S: Form>
In this case, the text in front of the text box is displayed instead of the value in the label. The button displays its original default value: sbumit.