现在的位置: 首页 > 综合 > 正文

struts错误 大全总结

2013年02月19日 ⁄ 综合 ⁄ 共 1436字 ⁄ 字号 评论关闭

我把原来一个工程导到的本机在打开struts-config.xml的时候就弹出下面的提示,这是什么原因啊 ?

Error!
Unable to access Struts Flow View due to XML and Struts validation errors detected in source. Please make corrections and try again.


解决方案:
出现这种情况可能是你的struts-config.xml里有重名了,比如说form-bean 的name重复了,还有action里的path重复了,
这都有可能出现这种情况,很多人都说的myeclipse的bug,开发myeclipse的人真觉得冤枉啊,可能还有其它的原因

====javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve mapping for action /queryStu

解决方案:

在JSP页面中
<html:form action="" method="">
</html:form>
action的内容如果与struts-config.xml 文件中的<action path=""><forward></forward></action> 中的path不匹配的时候会报这种错误

No action instance for path /queryStu could be created

解决方案:

<action path="/queryStu" type="t02.TagAction1" name="stu" attribute="stu" scope="request">
如果type对应不到一个Action类就会报上面的错误

Cannot retrieve definition for form bean null on action

解决方案:使用struts 标签的时候回报这种错误

jsp页面中的form可以不为其写formbean或者动态form(后台用request.getParameter()即可读取),但是如果使用了html:form的标签,就一定要为其写formbean或者动态formbean了。如下:
    <html:form action="test_All_Info.do">
    <td>
     <input type="submit" value="查看所以信息"/>
    </td>
    </html:form>
==================================>
    <form action="test_All_Info.do">
    <td>
     <input type="submit" value="查看所以信息"/>
    </td>
    </form>
struts处理中文是会有乱码:

解决方案:

在封装FormBean的ActionForm类中的覆盖reset方法,在里面设置response(/request).setCharacterencoding("gbk");

其他解决方法:http://www.javaeye.com/topic/179279

========================================================

贴出个错误大全供大家参考:

http://www.blogjava.net/soochow_hhb/archive/2005/06/11/5905.aspx

抱歉!评论已关闭.