我的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> 在只采用服务器端校验的时候一切正常,在使用客户端校验的时候,整个页面不能显示。
解决方案 »
- 求高人解决 java.sql.BatchUpdateException: ORA-00001: 违反唯一约束条件 (SCOTT.DEPT2_PK)
- 一个非常棘手的配置问题,高手请进?
- 有关sqlserver 2008 连接失败的问题
- 显示问题
- struts2 textfield label的问题
- Struts中文
- 点评Java full-stack框架
- hibernate sql查询难题,高手请进
- 讨论用j2ee构建企业级应用用到的各种工具.
- EJB事务回滚问题?
- java 解析XML文件,text 类型老报错,各位指点以下。
- 请问哪里有用struts做的小工程,我想下载研究研究,因为我自己怎么也配不通
我把自己的Jsp拷贝到struts自带的例子应用里面去,添加相应的配置以后,访问的时候,报一样的错。
真是郁闷!!
在action中,把validate="true"该为validate="false"
你原来是用服务器端验证的,validate是应该等于ture,现在你是用客户断验证的,改为false
配置如下:
<action path="/showUploadRecordsForm"
type="org.apache.struts.actions.ForwardAction"
parameter="uploadRecordsPage"
validate="false"/>就是在生成页面的时候出的问题。也就是说,还没等到提交表单,在显示表单的时候出错的。
type=""
name="uploadRecordsForm"
scope="request"
input="/showUploadRecordsForm"
validate="true">
<forward name="success" contextRelative="true" path=""/>
</action>
你在action中指定你要映射的form