小白求问! IDEA maven整合struts2访问不到action

qq_39215243 2018-01-10 05:03:09
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;
}

}
...全文
475 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_39215243 2018-01-10
  • 打赏
  • 举报
回复
自学道路路漫漫
qq_39215243 2018-01-10
  • 打赏
  • 举报
回复

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧