http://localhost:8080/myapp/index.jsp出错了

huyanqieyu 2008-09-05 03:43:33
jdk没问题了,http://localhost:8080/也可以,但http://localhost:8080/myapp/index.jsp就是不行,提示如下:
HTTP Status 404 - /myapp/index.jsp

--------------------------------------------------------------------------------

type Status report

message /myapp/index.jsp

description The requested resource (/myapp/index.jsp) is not available.


myapp里的WEB-INF的WEB-INF是:
<?xml version="1.0" encoding="ISO-8859-1"?>
  <!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">
  <web-app>
  <display-name>My Web Application</display-name>
  <description>
  A application for test.
  </description>
  </web-app>

index.jsp的内容是:
<html>
<body>
<center>
  Now time is:
</center>
</body>
</html>


我的tomcat是apache-tomcat-5.5.26
...全文
1271 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuguanmin 2012-07-18
  • 打赏
  • 举报
回复
非常感谢小猩猩 给我解决了难题,qq1713370913 希望能成为你的朋友
minapeng 2009-08-20
  • 打赏
  • 举报
回复
好答案!!
xian_hf 2008-09-05
  • 打赏
  • 举报
回复
用eclipse吗?
发布一下就到webapps下了
如果没有用IDE
在webapps下建工程包myapp-》jsp页面
-》WEB-INF->web.xml
qwj2006 2008-09-05
  • 打赏
  • 举报
回复
shi a !我以前遇到过这样的问题。但是
chjx1982 2008-09-05
  • 打赏
  • 举报
回复
按照你的意思在webapps建立了myapp文件夹
在myapp文件夹下建index.jsp
同时建立WEB-INF文件夹
注意index.jsp和WEB-INF是同一目录
然后在WEB-INF下建web.xml
web.xml内容如上,重启TOMCAT是可以访问的。
chjx1982 2008-09-05
  • 打赏
  • 举报
回复
我刚刚测试了
你的web.xml可能错了。

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>Web Application</display-name>

<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>


<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>




<jsp-config>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/tld/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/xml</taglib-uri>
<taglib-location>/WEB-INF/tld/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/functions</taglib-uri>
<taglib-location>/WEB-INF/tld/fn.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
cuilupeng999 2008-09-05
  • 打赏
  • 举报
回复
一般先查看服务器启动过程是否正确加载你的工程
liuheworld 2008-09-05
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 mengshan1986 的回复:]
引用 2 楼 huyanqieyu 的回复:
放在webapps下

webapps下不是有个root目录放在里面就可以了,这是个路径问题了
[/Quote]
mengshan1986 2008-09-05
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 huyanqieyu 的回复:]
放在webapps下
[/Quote]
webapps下不是有个root目录放在里面就可以了,这是个路径问题了
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 wangcheng8080 的回复:]
404就是文件没有找到,肯定是路径的问题~
[/Quote]
呵-春泥 2008-09-05
  • 打赏
  • 举报
回复
404就是文件没有找到,肯定是路径的问题~
huyanqieyu 2008-09-05
  • 打赏
  • 举报
回复
放在webapps下
mengshan1986 2008-09-05
  • 打赏
  • 举报
回复
myapp这个目录放在哪的,如果是放在tomcat的ROOT文件夹内是可以的,如果你放在别出,需要配置目录的

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧