创建Struts2 应用遇到的一些问题总结

访问页面时:
报错1:
"The origin server did not find a current representation for the target resource or is not willing to disclose that one exists."
原因是:
/hello.jsp
struts.xml中result标签里的name值跟对应…Action类的返回值不一致导致的.

报错2:
给方法继承 extends ActionSupport
然后引入 import com.opensymphony.xwork2.ActionSupport;
报错 "The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .cl"
原因是我的项目运行的JDK是1.8的,将项目运行环境改成MyEclipse 10自带的 JDK1.6 的就好了…

报错3 :
(package,action标签写出来不展示,这里用…替代)
"Package demo2 extends undefined package struts.default"
原因是:
<… name=“demo2” extends=“struts.default” namespace="/">
<… name=“form1” class=“cn.itcast.form.Form1DemoAction”></…>
</…>
应该是: struts-default

报错4:
报404错误
报错原因很可能就是,没有配置struts2过滤器.
还有一种可能就是配置文件中对应文件名称写的不对.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章