validation.xml文件
<BR><form-validation><BR><formset><BR><form name="bookform"><BR> <field property="name" depends="required,maxlength"><BR> <arg0 key="label.name"/><BR> <arg1 key="${var:maxlength}"/><BR> <var><BR> <var-name>maxlength</var-name><BR> <var-value>20</var-value><BR> </var><BR> </field><BR> <field property="sex" depends="required"><BR> <arg0 key="label.sex"/><BR> </field> <BR> <field property="email" depends="required"><BR> <arg0 key="label.email"/><BR> </field><BR> <field property="title" depends="required"><BR> <arg0 key="label.title"/><BR> </field> <BR> <field property="content" depends="required"><BR> <arg0 key="label.content"/><BR> </field> <BR></form><BR></formset><BR></form-validation>
<form-beans> <form-bean name="bookform" type="org.apache.struts.action.DynaActionForm" dynamic="true"> <form-property name="name" type="java.lang.String"/> <form-property name="sex" type="java.lang.String"/> <form-property name="email" type="java.lang.String"/> <form-property name="title" type="java.lang.String"/> <form-property name="content" type="java.lang.String"/> </form-bean> </form-beans> <global-forwards> <forward name="tomsg" path="/tomsg.jsp" /> </global-forwards> <action-mappings> <action path="/msgbook" type="lin.liu.wei.msgbook.MsgBookAction" name="bookform" scope="request" validate="true" input="/tomsg.jsp" /> </action-mappings> <message-resources parameter="lin.liu.wei.resource.Resource" /> <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" /> <set-property property="stopOnFirstError" value="false"/> </plug-in> <p class="indent">