问题描述
此网站不允许用户向他们的教程提出技术问题,我认为这些问题已被破解:
This site doesn't allow user to ask technical questions to their tutorial which I believe is broken:
我正在使用:
- maven:3.2.1
- tomcat 7
- java 1.7
- Eclipse:Luna Release(4.4.0)
- maven: 3.2.1
- tomcat 7
- java 1.7
- Eclipse: Luna Release (4.4.0)
我收到此消息:
WARNING: Could not find action or result
There is no Action mapped for namespace [/] and action name [] associated with context path [/Struts2Example]. - [unknown location]
我永远无法访问 login.jsp
页面,除非我输入完整的网址。但即便如此,当我点击提交按钮时,它也不会转到 welcome_user.jsp
页面。
I can never get to the login.jsp
page unless I enter the full url. But even then, when I click on the submit button, it doesn't go to the welcome_user.jsp
page either.
有人可以告诉我如何解决这个问题并让这个Hello World示例使用Eclipse吗?
Can someone tell me how I can fix this and get this Hello World example to work in using Eclipse?
推荐答案
如果您按照教程链接到该页面,并完成所有事情直到p。 7然后你应该按照运行它
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
http:// localhost:8080 / Struts2Example / User / Login.action
如果您尝试访问应用程序
If you tried to access application as
http://localhost:8080/Struts2Example
您将收到一条消息, 404错误代码返回给浏览器。
you will get a message and 404 error code is returned to the browser.
解决方法是将文件添加到Web根文件夹,该文件夹将浏览器重定向到正确的位置。
The workaround is to add the file to the web root folder that will redirect a browser to the correct location.
index.html
:
index.html
:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=User/Login.action">
</head>
<body>
<p>Loading ...</p>
</body>
</html>
同时修改Web应用程序部署描述符以将此文件名包含在欢迎文件列表中。
Also modify web application deployment descriptor to include this file name to the welcome files list.
web.xml
:
web.xml
:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
就是这样,如果你正在寻找Hello World教程,你应该使用这些引用:
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
这篇关于无法让Struts2 Hello World使用Eclipse和Maven工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!