日期:2014-05-18  浏览次数:20547 次

有个struts2的验证问题请教
用的是struts的框架验证(暂时只做了requiredstring验证),action配置是这样的:
<action   name= "login "   class= "index.Login ">
<result   name= "input "> /index/login.jsp </result>
<result> /index/ok.jsp </result>
</action>
 
我这样访问这个action
http://localhost:8080/login.action
 
可是我还没填写任何数据就会提示错误信息: "XXX不能为空 "
 
 
现在必须在login后面加个!input   才不会一访问就执行
http://localhost:8080/login!input.action
 
 
有什么办法使我访问http://localhost:8080/login.action时,填写数据点提交按纽后才提示错误信息呢??


------解决方案--------------------
你干吗要一开始就访问http://localhost:8080/login.action
不是开始访问http://localhost:8080/index/login.jsp时,填写数据点提交按纽后才是提交到
http://localhost:8080/login.action 然后再提示错误信息么??