Struts Hello world example : There is no Action mapped for namespace [/] and action name error

前端 未结 7 1639
小蘑菇
小蘑菇 2020-12-16 17:13

i am absolute beginner to Struts2. I am tying to follow tutorials on struts web site. i followed this tutorial. i have some trouble with it. i created dynamic web project on

相关标签:
7条回答
  • 2020-12-16 17:48

    In my case I had to rename Struts.xml ---> struts.xml

    0 讨论(0)
  • 2020-12-16 17:55

    I got the same error and got solution looking at tomcat log when restarting : doctype were missing in struts.xml

    so I added

    <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">
    

    now it works !

    0 讨论(0)
  • 2020-12-16 17:57

    I solved the issue by adding default-action-ref tag, for example,

    <default-action-ref name="home" />
    

    after package tag

    in struts.xml

    <package name="user" namespace="/" extends="struts-default">
    
    <default-action-ref name="upload" />
    
    0 讨论(0)
  • 2020-12-16 17:59

    Right click the project. Go to properties deployment build path and add all .jar files to /WEB-INF/lib.
    Then you shouldn't get this error.

    struts.xml should be located under directory: src/struts.xml..

    And WEB-INF/web.xml you we need to configure the struts based on filter..

    0 讨论(0)
  • 2020-12-16 18:00

    I had the same issue and I was facing it because of not mentioning the namespace correctly in struts.xml.

    I added the following snippet in the web.xml :

    <welcome-file>login.jsp</welcome-file>
    

    and also making the namespace as "/" default... Hope it answers your query..

    0 讨论(0)
  • 2020-12-16 18:01

    You have to create a classes/ folder under WEB-INF/ and put in your struts.xml file!

    0 讨论(0)
提交回复
热议问题