我的Jsp页面:
<%@ page contentType="text/html;charset=GBK" language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<html:messages id="msg" message="true" bundle="phoneRecord">
<bean:write name="msg"/><br/>
</html:messages><html:errors bundle="phoneRecord"/>
<html:javascript formName="uploadRecordsForm"/>
<html:form method="post" action="uploadRecords.do"
enctype="multipart/form-data" onsubmit="return validateUploadRecordsForm(this);">
<bean:message key="label.phoneRecord.upload.select" bundle="phoneRecord"/>
<html:file property="file"/> <html:submit/></html:form></html:html>validation.xml文件片段:
<form name="uploadRecordsForm">
<field property="file" depends="required">
<msg name="required" key="label.phoneRecord.upload.noFile"/>
</field>
</form>struts-config.xml文件片段:
<form-bean
name="uploadRecordsForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property
name="file"
type="org.apache.struts.upload.FormFile"/>
</form-bean> 在只采用服务器端校验的时候一切正常,在使用客户端校验的时候,整个页面不能显示。
<%@ page contentType="text/html;charset=GBK" language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<html:messages id="msg" message="true" bundle="phoneRecord">
<bean:write name="msg"/><br/>
</html:messages><html:errors bundle="phoneRecord"/>
<html:javascript formName="uploadRecordsForm"/>
<html:form method="post" action="uploadRecords.do"
enctype="multipart/form-data" onsubmit="return validateUploadRecordsForm(this);">
<bean:message key="label.phoneRecord.upload.select" bundle="phoneRecord"/>
<html:file property="file"/> <html:submit/></html:form></html:html>validation.xml文件片段:
<form name="uploadRecordsForm">
<field property="file" depends="required">
<msg name="required" key="label.phoneRecord.upload.noFile"/>
</field>
</form>struts-config.xml文件片段:
<form-bean
name="uploadRecordsForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property
name="file"
type="org.apache.struts.upload.FormFile"/>
</form-bean> 在只采用服务器端校验的时候一切正常,在使用客户端校验的时候,整个页面不能显示。
<html:javascript dynamicJavascript="false" staticJavascript="true"/>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>