<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="/WEB-INF/resource/" prefix="logic"%>
<%@ taglib uri="/WEB-INF/resource/" prefix="bean"%>
<%@ taglib uri="/WEB-INF/resource/" prefix="html"%>
<%@ taglib uri="/WEB-INF/resource/" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/resource/" prefix="nested"%>
<%@ taglib uri="/WEB-INF/resource/" prefix="c"%>
<%@ taglib uri="/WEB-INF/resource/" prefix="app"%>
<%@ taglib uri="/WEB-INF/resource/" prefix="fmt"%>
<%@ page import=".*"%>
<font color=red>This is the next page</font>
<html:form action="/tag">
<bean:define name="tagForm"/>
<html:hidden property="id" />
userName:<html:text property="userName" />
password:<html:password property="password" /><br>
checkbox1:<html:checkbox property="checkbox1" />
<input type="hidden" name="checkbox1" value="false">
checkbox2:<html:checkbox property="checkbox2" />
<input type="hidden" name="checkbox2" value="false">
<br>
gender:male<html:radio property="sex" value="1" />
female<html:radio property="sex" value="2" /><br>
<!--
The prerequisite for multibox to be checked is that it will be checked when the value in the hobbies array of the form bean attribute is equal to the value of the current multibox value attribute.
In actual projects, because the names of the check boxes here are the same, when passing values to action, you need to add some other values to distinguish them.
For example, the value of value can be used to concatenate different values: id:checkboxValue
The value here is the value of the name attribute output from the bean tag.
-->
<logic:notEmpty name="theForm" property="hobbies">
<logic:iterate name="theForm" property="hobbies" indexId="i">
box:<html:multibox property="hobbies" >
<bean:write name='i'/>
</html:multibox>
</logic:iterate>
</logic:notEmpty><br>
<!-- The optionsCollection tag does not take out objects from the pageContext, but only takes out arrays of the same name from the ActionForm associated with the form.
Among them, the value passed to the action after the page is submitted is the value of the value, not the value of the label.
-->
<html:select property="from">
<html:optionsCollection property="provinces" label="label" value="value"/>
</html:select>
<!-- html:options -->
<% list = new ();
(new ("Show value1","value1"));
(new ("Show value2","value2"));
(new ("Show value3","value3"));
(new ("Show value4","value4"));
("valuelist",list);%>
<html:select property="from">
<html:options collection="valuelist" property="value" labelProperty="label"/>
</html:select><p>
<!-- html:textarea -->
<html:textarea rows="5" cols="30" property="introduction"></html:textarea><br>
<input type="submit" value="register" ><br>
<!-- logic:present -->
<!-- Determines whether the specified object exists.
property property: Used at the same time as the name property. When the variable specified by the name property is a JavaBean, determine whether the object property specified by the property property exists.
-->
<%("ExistingString","teststring");%>
<logic:present name="ExistingString">
The value of ExistingString is <bean:write name="ExistingString"/>
</logic:present>
<logic:notPresent name="ExistingString">
The value of ExistingString is <bean:write name="ExistingString"/>
</logic:notPresent><p>
<!-- logic:empty -->
<%("test1","");%>
<logic:empty name="test1">
The test1 variable is empty!
</logic:empty><p>
<!-- logic:equal -->
<!-- When both strings compared can be converted into numbers, they are compared according to the size of the number. When they cannot be converted into numbers, they are compared according to the string. -->
<%("test1",new Integer(10000));%>
<logic:equal name="test1" value="10000">
The variable test1 is equal to ${test1}
</logic:equal> <p>
<!-- html:link -->
<!-- name attribute: Its value is an object name of type, and each "key/value" pair of it represents a pair of "parameter name/parameter value" -->
<html:link href="" href="">
Sina.com
</html:link>
<%String test1 = "testABC";
("stringtest",test1);%>
<html:link page="/" paramId="testString" paramName="stringtest">
Test page 1
</html:link>
<%HashMap para_map = new HashMap();
para_map.put("testString","testABC");
para_map.put("testInt",new Integer(10000));
("map1",para_map);%>
<html:link page="/" name="map1">Test Page 2</html:link> <p>
<!-- logic:match -->
<!-- Determines whether the specified constant string is included in the variable.
location attribute: There are only two values that can be taken, one is "start" and the other is "end".
start means starting with the string specified by value, end means end
-->
<%("test","Hello,World");%>
<logic:match name="test" value="Hello">
<bean:write name="test"/>
</logic:match>
<logic:match name="test" value="Hello" location="end">
<bean:write name="test"/>
</logic:match><p>
<!-- logic:iterate --><!-- -->
<!-- traversal of array -->
<%String [] testArray1 = {"str0","str1","str2","str3","str4","str5","str6"};
("test1",testArray1);%>
<logic:iterate name="test1">
<bean:write name="array1"/>
</logic:iterate><br>
<!--length attribute specifies the number of output elements, and the offset attribute specifies the output starting from the first element. Here, 2 means output starting from the third element
indexId attribute, which specifies the sequence number of a variable that stores the elements being accessed in the current collection.
-->
<logic:iterate name="test1" length="3" offset="2" indexId="i">
The first character <bean:write name="i"/> is ${array1 };
</logic:iterate><br>
<!-- traversal of map -->
<% countries = new ();
("country1","China");
("country2","USA");
("country3","UK");
("country4","France");
("country5","Germany");
("countries",countries);%>
<logic:iterate name="countries">
<bean:write name="country" property="key"/>: <bean:write name="country" property="value"/>
</logic:iterate> <br>
<logic:iterate name="countries">
${ }:${ }
</logic:iterate><br>
<!-- traversal of list -->
<% list1 = new ();
("str1");
("str2");
("str3");
("str4");
("str5");
("testlist",list1);
%>
<logic:iterate name="testlist" indexId="index">
<bean:write name="index"/>:
<bean:write name="showlist"/>
</logic:iterate><br>
<!-- Nested traversal of each element in this ArrayList object is another String array -->
<%String [] colors = {"red","green","blue"};
String [] countries1 = {"China","US","France"};
String [] persons = {"Jordan","Bush","Clinton"};
list2 = new ();
(colors);
(countries1);
(persons);
("list2",list2);%>
<logic:iterate name="list2" indexId="j">
<bean:write name="j"/>:
<logic:iterate name="list2Id" indexId="k">
<bean:write name="subId"/>
</logic:iterate>
</logic:iterate><p>
<!-- logic:messagesPresent -->
<!-- The tag is to determine whether there is a specific ActionMessages or ActionErrors object in the request.
name attribute: specifies the key value when ActionMessages is stored in the request object.
message attribute: There are two values for the message attribute.
When it is true, it means that Globals.MESSAGE_KEY is used as the key value of ActionMessages from the request object. At this time, nothing is valid regardless of name specified;
When it is false, it means that the value specified by the name attribute needs to be used as the key value of ActionMessages from the request object.
If the value of the name attribute is not set at this time, the default Globals.ERROR_KEY is used.
property property: Specifies the key value of a specific message in the ActionMessages object.
-->
<% messages = new ();
("message1",new (".error1"));
(.MESSAGE_KEY,messages); %>
<logic:messagesPresent message="true" property="message1">
The actionMessage found exists.
</logic:messagesPresent>
</html:form>