eclipse中struts2出错

来源:互联网 发布:淘宝讲师爱上黄昏 编辑:程序博客网 时间:2024/05/20 13:15

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!其实错误提示的很明显。


原创粉丝点击