eclipse中struts2出错

1、There is no Action mapped for namespace [/] and action name [Login] associated with context path [/eprint]错误

做如下检查:

1、确保struts.xml文件名大小写正确:struts.xml

2、确保struts.xml文件在src目录下(很重要!后面就着重说这个)


2、The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)".错误

查了资料才知道,原来是package里元素必须按照一定的顺序排列:

result-types 
interceptors 
default-interceptor-ref 
default-action-ref 
default-class-ref 
global-results 
global-exception-mappings 
action*(就是所有的action放到最后)  


3、Parse Fatal Error at line 4 column 43: 已经为元素 "web-app" 指定属性 "xmlns"错误

于是Ctrl+A全选,格式化代码(Ctrl+Shift+F)即看到下面红色的错误。原来是重复了。删除以下红色的代码,重新运行,OK!其实错误提示的很明显。


发布了10 篇原创文章 · 获赞 6 · 访问量 8万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章