Unable to get Struts2 Hello World to work using Eclipse and Maven

前端 未结 1 1062
余生分开走
余生分开走 2020-11-30 15:01

This site doesn\'t allow user to ask technical questions to their tutorial which I believe is broken:

http://www.mkyong.com/misc/how-to-use-mkyong-tutorial/

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 15:24

    If you follow the tutorial, which is linked to the page Struts 2 Hello World Example, and done everything till p. 7 then you should Run it as is written

    In Struts2, you can access the action class directly with a suffix of .action.

    http://localhost:8080/Struts2Example/User/Login.action

    If you tried to access application as

    http://localhost:8080/Struts2Example
    

    you will get a message and 404 error code is returned to the browser.

    WARNING: Could not find action or result There is no Action mapped for namespace [/] and action name [] associated with context path [/Struts2Example]. - [unknown location]

    The workaround is to add the file to the web root folder that will redirect a browser to the correct location.

    index.html:

    
    
    
        
    
    
    
    

    Loading ...

    Also modify web application deployment descriptor to include this file name to the welcome files list.

    web.xml:

    
        index.html
    
    

    That's it, if you are looking for the Hello World tutorial, you should use these references:

    • Hello World
    • Hello World Using Struts 2
    • How To Create A Struts 2 Web Application
    • Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application

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