struts.xml web.xml配置正常,访问action时出现404

工程项目部署成功,能访问默认页面

action 一出来    挂了....


工程结构

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_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>StrutsDemo</display-name>
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>

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="hellodemo" namespace="/" extends="struts-default" >
        <action name="hello" class="cn.action.HelloAction">
            <result name="ok">/hello.jsp</result>
        </action>
    </package>

</struts>

 反复确认n多遍 ,配置文件都被我看的不好意思了,还是不行!!!!

 作为一个初学者,这样虐我真的好么,以为就这么结束了么?太年轻太年轻,哈哈,故事当然会有转折了,是不是可以来一句 

守得云开见月明,
记录完要蹦蹦跳跳的好好吃一顿去,哦耶。

删除框住的jar包,然后效果如下

 action访问会默认是执行execute方法的

参考: https://blog.csdn.net/e_inch_photo/article/details/78833810

猜你喜欢

转载自www.cnblogs.com/joan-HTY/p/8953293.html