tomcat的主页也可以浏览,可是为什么jsp程序无法运行呢。我把我用笔记本编辑的jsp程序放在台式电脑D:\Tomcat 5.0\webapps\test.jspjsp文件的路径没有放错吧,我在地址栏上输出http://localhost:8080/test.jsp的时候,一开始是提示500错误到底什么原因呀,哪位高手帮帮忙。谢谢 ! 

解决方案 »

  1.   

    "我把我用笔记本编辑的jsp程序放在台式电脑D:\Tomcat 5.0\webapps\test.jsp"放到webapps\ROOT里才可以使用http://localhost:8080/test.jsp访问
      

  2.   


    放到webapps\ROOT也不行
    test.jsp
    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
      </head>
      
      <body>
        This is my JSP page. <br>
      </body>
    </html>
      

  3.   

    如果有项目名http://localhost:8080/EclipseTest/test.jsp
    或者你直接把test.jsp放在ROOT下面http://localhost:8080/test.jsp
      

  4.   


    第一种方法不行,因为我的myeclipse8.5在project deployments里ADD不能显示我的Tomcat 5.0
    第二种我把test.jsp放到webapps\ROOT也不行
      

  5.   

    我把你的源码复制了,放在我这可以运行,说明是你服务器有问题。
    是不是你把端口改了。
    用一下127.0.0.1:8080.
    500也是服务器端错误的提示。
    你好好看看你的TOM猫的设置。
      

  6.   


    但是我hello.jsp 可以运行,只是test.jsp不能运行,是什么问题?
    hello.jsp <html>
        <head>
           <title>HELLO JSP WORLD!!!</title>
        </head>
        <body>
            <%
               out.println("Hello World!!!") ; //向浏览器输出
            %> 
        </body> 
    </html>
      

  7.   


    你的test.jsp在项目MyeclipseTest中放在哪个目录下
      

  8.   

    C:\Workspaces\MyEclipse 8.5\EclipseTest\WebRoot
      

  9.   

    也许我明白了,你的Tomcat是怎么启动的?
    是在MyEclipse里启动的还是从命令行或者Tomcat的启动工具启动的?
    这两个完全启动后是不一样的。1. test.jsp放到Tomcat的webapps\ROOT里,访问http://localhost:8080/test.jsp时,Tomcat必须是从命令行或者他的启动工具启动,不能使用MyEclipse启动。2. test.jsp放到WebRoot里,访问http://localhost:8080/test.jsp时,Tomcat要使用MyEclipse启动,从命令行启动的Tomcat不认识这个网页。
      

  10.   


    我是双击桌面开始程序栏的tomcat图标启动的它的.MyEclipse不能启动它,没关联.因为我的myeclipse8.5在project deployments里ADD不能显示我的Tomcat 5.0
      

  11.   

    用记事本写的?直接放在webapp下面不行吧,好像要deploy吧
    或者要配置一下吧
      

  12.   


    帮忙看下我这程序哪里出问题?
    test.jsp
    <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
      <base href="<%=basePath%>">
        
      <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
      </head>
       
      <body>
      This is my JSP page. <br>
      </body>
    </html>
      

  13.   

    不会吧,看起来没什么问题。。你是用eclipse8.5写的吧。那你访问它本身的index.jsp能够访问到么?如果能访问到,那你直接把index.jsp的代码复制到你写的那个里面改一下就好了么,如果连index.jsp访问都出错的话,那原因肯定在你tomact上了。。或者你jdk没配置好