您可能会发现这是重复但我没有弄到我的代码有什么问题,所以请帮帮我
我正在使用struts.xml
切换到struts 2 convention-plugin
并且遇到映射操作问题
there is no action mapped for namespace [/] and action name [login] associated with context path [/eCensus]
项目结构
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>eCensus</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>struts.devMode</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>actionPackages</param-name>
<param-value>com.shantaram.ecensus.actions</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
LoginAction类
package com.shantaram.ecensus.actions;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
public class LoginAction extends ActionSupport implements Preparable {
private static final long serialVersionUID = 1L;
@Override
public void prepare() throws Exception {
// TODO Auto-generated method stub
System.out.println("prepare Login Action");
}
@Override
public String execute() throws Exception {
// TODO Auto-generated method stub
return super.execute();
}
}
Jars我正在使用