小白求问! IDEA maven整合struts2访问不到action
HTTP Status 404 - There is no Action mapped for namespace [/] and action name [test_myId] associated with context path [].
我的struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<package name="user" extends="struts-default" namespace="/">
<action name="test_*" method="{1}" class="com.test.Myaction">
<result name="success">/result.jsp</result>
</action>
</package>
</struts>
我的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
我的action
package com.test;
import com.opensymphony.xwork2.ActionSupport;
public class Myaction extends ActionSupport{
private String id;
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public String myId(){
System.out.print("111111");
return SUCCESS;
}
}