myeclipse里面建的工程day09运行没有关问题,可以day09_user在浏览器会出现404异常
myeclipse里面建的工程day09运行没问题,可以day09_user在浏览器会出现404错误
最近在学《方立勋JavaWeb视频教程》跟着视频学习Java。
day09和day_user的代码编译都没有问题。但是
http://localhost:8080/day09_user/index.jsp用浏览器出现404错误。而http://localhost:8080/day09/index.jsp没问题。
请教是什么原因呢?从网上查了,也查不出原因
这是day09_user中的index.jsp的代码:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>首页</title>
</head>
<body>
<a href="${pageContext.request.contextPath }/servlet/RegisterUIServlet">注册</a> <br>
<a href="${pageContext.request.contextPath }/servlet/LoginUIServlet">登录</a> <br>
</body>
</html>
这是day09_user中的web.xml的代码:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>RegisterUIServlet</servlet-name>
<servlet-class>cn.itcast.web.UI.RegisterUIServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RegisterUIServlet</servlet-name>
<url-pattern>/servlet/RegisterUIServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
谢谢!!!
------解决方案--------------------
404是路径问题。
你的day09_user 是自己新建的工程,名字叫做day09_user?
还是从day09复制过来的呢,如果是复制的,那你的Web Project Settings 有没有修改呢,没有修改的话,就肯定会404了。
------解决方案--------------------
这种是典型的内部错误,你看看day/index.jsp的内容和day09_use/index.jsp的页面是否一致,如果是一致的,将其改成不一致的试一试呢?如果还是出现这个问题的话,那么你看看你的tomcat中的webapps目录下是否存在day09_use这个文件夹,如果没有证明你没有发布上去或者是day09_use根本就是day09的复制品
最近在学《方立勋JavaWeb视频教程》跟着视频学习Java。
day09和day_user的代码编译都没有问题。但是
http://localhost:8080/day09_user/index.jsp用浏览器出现404错误。而http://localhost:8080/day09/index.jsp没问题。
请教是什么原因呢?从网上查了,也查不出原因
这是day09_user中的index.jsp的代码:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>首页</title>
</head>
<body>
<a href="${pageContext.request.contextPath }/servlet/RegisterUIServlet">注册</a> <br>
<a href="${pageContext.request.contextPath }/servlet/LoginUIServlet">登录</a> <br>
</body>
</html>
这是day09_user中的web.xml的代码:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>RegisterUIServlet</servlet-name>
<servlet-class>cn.itcast.web.UI.RegisterUIServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RegisterUIServlet</servlet-name>
<url-pattern>/servlet/RegisterUIServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
谢谢!!!
------解决方案--------------------
404是路径问题。
你的day09_user 是自己新建的工程,名字叫做day09_user?
还是从day09复制过来的呢,如果是复制的,那你的Web Project Settings 有没有修改呢,没有修改的话,就肯定会404了。
------解决方案--------------------
这种是典型的内部错误,你看看day/index.jsp的内容和day09_use/index.jsp的页面是否一致,如果是一致的,将其改成不一致的试一试呢?如果还是出现这个问题的话,那么你看看你的tomcat中的webapps目录下是否存在day09_use这个文件夹,如果没有证明你没有发布上去或者是day09_use根本就是day09的复制品