当前位置:编程学习 > JAVA >>

struts2向验证页面向上一个action页面select值问题


用struts2+spring3.12+hibernate4.17做上面的功能。
在struts.xml中用下面的拦截器校验上传的图片超大或格式不对
[align=left] <action name="insertHospital"
class="com.harvest.makeappointment.hospital.action.SaveHospital">

<interceptor-ref name="fileUpload">
<param name="allowedTypes">
image/bmp,image/png,image/gif,image/pjpeg
</param>
<param name="maximumSize">109600</param>
</interceptor-ref>
<interceptor-ref name="defaultStack" />

<result name="input">/hospital/hospitalsummary/inhospitalsummary.jsp</result>
<result name="success">/hospital/hospitalsummary/viewhospitalsummary.jsp
</result>
</action>[/align]
当传入的格式不对或文件超大时,可以正确的进行拦截。但是“等级”的值没有带入这个inhospitalsummary页面,每次都是提示赋值出错。

请问各位大大们,如何处理这种情况的? --------------------编程问答-------------------- 这是因为struts2的文件上传是在拦截器里完成的。一旦内容超过限制,就直接addActionError了
就是报出struts.messages.error.file.too.large这个里面配置的信息了不会进入action的
所以你action里面的内容没有值 --------------------编程问答-------------------- 那就先页面验证,确保等级不为空在上传
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,