在Tomcat上通过Eclipse运行项目时出现404
问题描述:
我有一个具有以下目录结构的Struts 2项目.但是,当我尝试在Tomcat 7上使用Eclipse运行该项目时,会出现404错误.
I have a Struts 2 project with following directory structure. But when I try to run this project using Eclipse on Tomcat 7, it gives me 404 error.
Struts.xml
:
Struts.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<struts>
<action name="login" class="com.actions.LoginAction" method="execute">
<result name="success">/jsp/login.jsp</result>
</action>
</struts>
login.jsp
:
login.jsp
:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login Page</title>
</head>
<body>
<s:form action="login" method="post">
Login name : <input type="text" value="name"/>
</s:form>
</body>
</html>
在路径http://localhost:8080/StrutsPro/jsp/login.jsp
上运行时,它会给出HTTP 404,为什么?
On running at path http://localhost:8080/StrutsPro/jsp/login.jsp
, it gives HTTP 404, why?
答
而是检查web.xml.
examine web.xml instead.
否则将所有.jsp文件放入WebContent文件夹
else put your all .jsp files in WebContent folder