页面上面加上:<%@ page contentType="text/html; charset=gb2312" language="java" %>

解决方案 »

  1.   

    出现的是什么错误?
    你把你的文件放在ROOT根目录下试试
      

  2.   

    把你的那个测试文件放到ROOT下面,然后直接在IE里输入http://localhost:8080/test.jsp 就行了。
      

  3.   


    上面的方法我都试过了,都不行的
    是不是配置上还有什么问题呢?
    浏览器上的显示HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSP
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
    org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:439)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK
    org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)
    org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:929)
    org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
    org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:407)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
    --------------------------------------------------------------------------------Apache Tomcat/5.0.30
      

  4.   

    但是http://localhost:8080都能访问呀,tomcat的欢迎页面都能看到的
      

  5.   

    to:xitianjile(空想社會主義) 
    不循环的时候也不行的我试过这个也不行<html>
    <head><title>大家好</title>
    </head>
    <body>
    <% out.println(" 大家好,我的第一个jsp程序"); %>
    </body>
    </html>
      

  6.   

    是不是只要嵌入了java代码就不行了?
    你的是编译错误。
    这种问题确实很头疼。。
      

  7.   

    是不是j2sdk的配置有问题呢,我看提示错误里找不到javac呀,但我就是按照上面的步骤配的呀
    我来试试看纯html行不行各位大虾,会是什么问题呢,小弟急呀!!!
      

  8.   

    你运行cmd。
    然后运行javac看看。。看看能不能出东西。
    你好像没有配置path
      

  9.   

    这是我的classpath:C:\Program Files\Common Files\Software AG\sagxds.jar;%SAG_COMMON%\saglic.jar;%SAG_COMMON%\sagxds.jarpath:C:\j2sdk1.4.1_01\bincatalina_home:D:\jakarta-tomcat-5.0.12java_home:C:\j2sdk1.4.1_01引入的东西比你的少得多!
    好像没碰过这种问题。
      

  10.   


    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK
    环境变量的JAVA_HOME指向了正确的Jdk位置吗?
      

  11.   

    我在cmd里用javac编译一些applet程序,没有提示错误的
      

  12.   

    JAVA_HOME没设置对。你试试把path改成直接路径试试!
      

  13.   

    C:\Documents and Settings\Administrator>javac
    Usage: javac <options> <source files>
    where possible options include:
      -g                        Generate all debugging info
      -g:none                   Generate no debugging info
      -g:{lines,vars,source}    Generate only some debugging info
      -nowarn                   Generate no warnings
      -verbose                  Output messages about what the compiler is doing
      -deprecation              Output source locations where deprecated APIs are us
    ed
      -classpath <path>         Specify where to find user class files
      -sourcepath <path>        Specify where to find input source files
      -bootclasspath <path>     Override location of bootstrap class files
      -extdirs <dirs>           Override location of installed extensions
      -d <directory>            Specify where to place generated class files
      -encoding <encoding>      Specify character encoding used by source files
      -source <release>         Provide source compatibility with specified release
      -target <release>         Generate class files for specific VM version
      -help                     Print a synopsis of standard options要是配置了正确的javac。只输入了javac会显示以上的内容你能运行applet那是因为windows系统本来就有java虚拟机。
    也有可能你是在jdk目录下面运行的
      

  14.   

    能显示以上的内容的,我试过了
    是不是说明JAVA_HOME已经设置对了呢
      

  15.   

    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK
    org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler
    需要把
    %JAVA_HOME%/lib/tools.jar复制到%TOMCAT_HOME%/common/lib下面。
      

  16.   

    to zsq666(bluechina):呵呵,不行呀,还是一样的错误,是不是把j2sdk/lib/tools.jar直接拷到tomcat5/common/lib呢
      

  17.   

    要学会自己解决!尤其是这种简单问题,否则你将失去一次锻炼机会。/********************************************
    The load-on-startup element indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the web application. The optional contents of these element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses.  If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets ed with lower integers are loaded before servlets ed with higher integers. The container may choose the order of loading of servlets with the same load-on-start-up value.