当前位置: 代码迷 >> Java Web开发 >> 这个容易的jsp文件为什么运行得到的页面却是404
  详细解决方案

这个容易的jsp文件为什么运行得到的页面却是404

热度:123   发布时间:2016-04-13 22:24:18.0
这个简单的jsp文件为什么运行得到的页面却是404
jsp代码如下:

<html>
<head><title>Hello World</title></head>
<body>
Hello World!<br/>
<%
out.println("Your IP address is " + request.getRemoteAddr());
%>
</body>
</html>

-----------------------------------------------------------------------------------------------------------------
xml文件代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>OrderMeal</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

错误截图:

------解决思路----------------------
web-inf 下面的jsp 是不对外可见的。把他放到webcontent下面。
------解决思路----------------------
web-inf 下面的页面后台代码转发才能看见。
------解决思路----------------------

文件路径不对啊!

正如楼上所说的!
  相关解决方案