javaweb项目,成功配置Tomcat,之前可以运行登录界面(index.jsp),其他界面的跳转实现不了(404错误),后来Tomcat服务器启动错误,按网上的方法改了server.xml文件中的context行为绝对路径,现在服务器可以启动,但是每个页面都报404错误,求解原因。
可能是web.xml文件有误,也可以是servlet代码部分有问题。
附上各部分代码和目录:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
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_3_0.xsd">
This is the description of my J2EE component
This is the display name of my J2EE component
RegisterAction
com.register.RegisterAction
This is the description of my J2EE component
This is the display name of my J2EE component
LoginAction
com.login.LoginAction
This is the description of my J2EE component
This is the display name of my J2EE component
ProductAction
com.product.ProductAction
This is the description of my J2EE component
This is the display name of my J2EE component
LogoutAction
com.logout.LogoutAction
RegisterAction
/servlet/RegisterAction
LoginAction
/servlet/LoginAction
ProductAction
/servlet/ProductAction
LogoutAction
/servlet/LogoutAction
<!-- 配置 过滤器 -->
MyFilter
com.filter.MyFilter
MyFilter
<!-- /*表示过滤所有页面 ,/main.jsp 表示只过滤main.jsp页面-->
/main.jsp
MyFilter
<!-- /*表示过滤所有页面 /addProduct.jsp 表示只过滤addProduct.jsp页面-->
/addProduct.jsp
index.jsp
小女子肝404错误熬了几个晚上了,大作业眼看就要交了,求大神解答~
这要看你的登录页面上的 那个路径写对了没
路径有问题呗 看你自己的配置文件
404就是你的路径不对,肯定是你写的路径不对罗
路径问题,必须得,看看能不能访问项目的页面