Could not find action or result There is no Action mapped for namespace [/]

**struts.xm**l

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <!-- struts常量配置
        struts.i18n.encoding:设置编码
        struts.action.extension:配置访问后缀名
        struts.enable.DynamicMethodInvocation:启用动态方法调用    访问路径加上【!方法名】(action配置中method属性不写)
     -->
<!--    <constant name="struts.i18n.encoding" value="UTF-8"></constant>
    <constant name="struts.action.extension" value="action,do,"></constant>
    <constant name="struts.enable.DynamicMethodInvocation" value="true"></constant> -->
    <package name="struts2" extends="struts-default">
        <!-- 配置全局跳转视图 -->
        <global-results>
            <result name="success">/index.jsp</result>
        </global-results>
        <!-- 配置action -->
        <action name="add" class="action.firstAction" method="add">
            <result name="success">/index.jsp</result>
        </action>
    </package>
</struts>```

**

web.xm
------

l**


<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

看了几遍没有问题,在网上也找了好多也没有解决,因为我的项目是web项目,我就直接添加到服务器上,我之前都是部署上去的,再访问http://localhost:8080/OA/add.action就好了,误打误撞给搞好了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值