请问我的3个JSP文件,在TOMCAT5.5+JDK1.5的环境下一运行就什么都不显示IE白白的什么显示都没有,请问是不是缺少什么软件没安。本人十分费解
1。classic.jsp<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=gb2312"%> 
<%@ page info="一个典型的JSP" %>
<!--这是一个典型的JSP,它包含了JSP中常用的元素-->
<%! String getDate()
    {
        return new java.util.Date().toLocaleString();
    }
    int count=10;
%>    
<html>
<head>
<title>一个典型的JSP</title>
</head>
<body>
<%@ include file="header.jsp" %>
<div align="center">
<table>
<tr bgcolor=777777>
<td>------------------------</td>
</tr>
<%
int i;
//color表示颜色,通过它来动态控制颜色。
String color1="99ccff";
String color2="88cc33";
for(i=1;i<=count;i++)
{

String color="";
if(i%2==0)color=color1;
else color=color2;
out.println("<tr bgcolor="+color+"><td>------------------------</td></tr>");
}
%>
       
</table>
<hr>
当前的时间是:
<%-- 下面是使用表达式的例子--%>
<%=getDate()%>
<jsp:include page="copy.xml"/>
</div>
</body>
</html>
第二个header.jsp
<%@ page language="java" contentType="text/html; charset=gb2312"%> 
<center>
<hr>
JSP的典型例子
</hr></center>第三个copy.xml<center>
{{{&copy;JSP应用开发详解}}}
</center>

解决方案 »

  1.   

    你的header.jsp中已经定义了charset,在classic.jsp中就不要定义了另外,你的copy.xml改成copy.html我不清楚能不能include 一个xml的文件,没用过
      

  2.   

    哦,这是书上的一个例子的代码,从光盘上COPY下来的
      

  3.   

    你把文件部署到tomcat下了没有,ie报错应该是404 not found吧。
      

  4.   

    提示:
    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
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause java.lang.IllegalStateException
    org.apache.jasper.runtime.ServletResponseWrapperInclude.getOutputStream(ServletResponseWrapperInclude.java:62)
    org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:780)
    org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:348)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
    org.apache.jsp.classic_jsp._jspService(org.apache.jsp.classic_jsp:107)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.15 logs.
      

  5.   

    你把这几个jsp文件放在哪里???你是输入什么网址访问的
      

  6.   

    放到D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\index\下面了
    输入http://localhost:8080/index/classic.jsp
    请问是不是我缺少什么LIB文件,书上的例子不会错的,本人十分着急,谢高手。
      

  7.   

    书上的例子常常是cuo的,你先把copy.xml改简单一点试试看<center>
     JSP应用开发详解
    </center>
      

  8.   

    哦,我把CLASSIC。JSP的include xml的选项去了就好了,请问<jsp:include page="copy.xml"/>应该有LIB文件才能导入吧,高手