日期:2014-05-18  浏览次数:20705 次

初学jsp+tomcat,请教一个相当简单的问题!
书上是这样说的:
        例如建立new这个项目,在webapps下建立new文件夹,然后在这个文件夹下建立new.xml,然后编辑这个文档如下:
<contextpath= "/new "docBase= "c:\new "debug= "0 "privileged= "true "> </Context>
        然后在Tomcat\webapps\new下创建index.txt文件,文件内容如下:
<%@   page   language= "java "   %>
<html>
<head>
<title> Hello   World! </title>
</head>
<body   bgcolor= "#FFFFFF "   text= "#000000 ">
<%   out.println( "Hello   World! ");   %>
</body>
</html>
然后把它的文件名改为index.jsp,在浏览器地址栏中输入http://localhost:8080/new,就可以浏览到。


可是我这样做却是这样的结果:
HTTP   Status   404   -   /new

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

type   Status   report

message   /new

description   The   requested   resource   (/new)   is   not   available.


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

Apache   Tomcat/5.0.28

------解决方案--------------------
new.xml要放到tomcat的conf\Catalina\localhost下,同时new文件夹下应该有个WEB-INF文件夹,里面放web.xml文件,可以看看\webapps\ROOT文件夹的结构和内容
------解决方案--------------------
其实也不必须,你看看jsp-examples里面的结构就知道了,