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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM