Struts2实现登录与注册模块时发生如下报错!怎么解决呢?

``` org.apache.struts2.dispatcher.Dispatcher.warn Could not find action or result: /JavaWeb3-1/login There is no Action mapped for namespace [/] and action name [login] associated with context path [/JavaWeb3-1]. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63) ``` ### struts.xml内容如下: ``` /register_success.jsp /register.jsp /login_success.jsp /login.jsp image/jpeg inputStream ``` ![目录结构](http://wenda.chinahadoop.cn/uploads/questions/20161003/3a9781208b9b0bb791c3c20913bdaa72.png "目录结构")

macg - 80后IT男

赞同来自: @CrazyChao

There is no Action mapped for namespace [/] and action name [login] associated with context path [/JavaWeb3-1]. - [unknown location]   这句话的意思是: web容器把/JavaWeb3-1解析为项目名,把/login解析为action,则/解析为namespace. 显然你配置的/JavaWeb3-1是namespace,login是action. 你看看哪里配错了.   另外,有经验的程序员,尽量不在各种命名里带中划线(减号), 下划线还好(也应尽量少带),中划线是大忌.

_HBase

赞同来自:

把namespace="/JavaWeb3-1"改为namespace="/"

要回复问题请先登录注册