编写好jsp文件 在地址栏内输入访问地址可以访问 为什么从tomcat访问页面中一步一步打开访问就不行呢?工程已经发布到tomcat应用程序了该怎么做?有没有指导性的文档?求助大虾们http://localhost:8080/WebProject/MyJsp.jsp输入这个网址可以访问而打开访问界面 http://localhost:8080/WebProject/却提示404错误
调试欢乐多
<welcome-file>MyJsp.jsp</welcome-file>
</welcome-file-list>
能不能说具体点?是web工程webinfo下的web.xml吧 那我里面有好几个jsp页面怎么设置啊?只是按照你说的设置貌似还是不行哦
<welcome-file>MyJsp.jsp</welcome-file>
<welcome-file>MyJsp2.jsp</welcome-file>
这样写的目的是如果第一个找不到,会自动找第二个的,但是如果你想访问你的那些页面的,就在欢迎页面中把其他的页面都超链接进来就可以了。当然如果你不超链接,又不添加欢迎页面,那肯定是不行的。
<welcome-file>MyJsp.jsp</welcome-file>
</welcome-file-list>
web.xml里面只要有这一段,表示tomcat服务启动后,你的 http://localhost:8080/WebProject/ 默认进入的是MyJsp.jsp页面,而不需要在web.xml里面写其他的页面,不然tomcat就会找web.xml下面第一段
<welcome-file-list>指向的页面。
<?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">
<welcome-file-list>
<welcome-file>goods_list.jsp</welcome-file>
<welcome-file>public.jsp</welcome-file>
<welcome-file>set_number.jsp</welcome-file>
</welcome-file-list>
</web-app>