在Tomcat上通过Eclipse运行项目时出现404 [英] 404 when running project through eclipse on Tomcat

查看:562
本文介绍了在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

这篇关于在Tomcat上通过Eclipse运行项目时出现404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆