还忘了一点,当我用第一条指令时有问题,但换成第二条后,刷新一下页面可以看到预期正确的jsp页面,就是不能编译第二条指令,一编译就报出以上错误信息!和同事讨论过,大家说有时会遇到这样的问题,一致认为是include命令的问题,但不知道如何解决!请教各位高手

解决方案 »

  1.   

    估计是  flush 的问题。sun 后来的jdk 中建议不用 flush = true但是一些人士发现那样做还是有问题,
    具体什么问题我也不太清楚, 你可以在  《jsp从入门到精通》 sybase里面找到
    相关信息。
      

  2.   

    <jsp:include page = "../header.jsp" flush ="false">
    使用include时,在修改后。一定要把原来编译的class删掉。这样服务器才能重新编译。你把 相应目录下的(根据服务器不同,存放位置不同。resin 在work下) header_jsp.class文件删掉。应该就可以了。
      

  3.   

    我把tomcat下的work和conf文件都删掉也不行啊,同样报错!还有更好的意见吗?
      

  4.   

    include file的话,把重复的contenttype去掉。
      

  5.   

    我已经删掉了重复的contenttype,依然不行啊!现在我只能不用include命令,直接把要得东西写上去了,暂时没办法啊!有谁碰到过这样的情况!有什么好办法啊,这是一个值得关注的问题!大家都来看看
      

  6.   

    1、<jsp:include page = "../header.jsp">
    用这种方法时,header.jsp中可以有<html><body>等标签,也就是说header.jsp是个完整的页面2、<%@ include file= "../header.jsp" %>
    用这种方法时,header.jsp中不能有<html><body>,它必须是一个不完整的页面,
      

  7.   

    这是一个很讨厌的BUG! 我已经写了一个Perl脚本用来完成预处理,将<%@include 的文件弄进里面去:----------------------------------------------------------
    #!/usr/bin/perluse strict; 
    use FileHandle; my $curdir = "."; 
    my $sep = "\\"; sub path_split {
    my ($text) = @_; 
    my $pre = 0; 
    my $l = length($text); 
    my @result; 
    my ($temp, $i); 
    for ($i = 0; $i < $l; $i++) {
    if (substr($text, $i, 1) =~ m/[\/\\]/) {
    $temp = substr($text, $pre, $i - $pre); 
    if (length($temp)) {
    push(@result, $temp); 
    }
    $pre = $i + 1; 
    }
    }
    if ($pre < $l) {
    push(@result, substr($text, $pre)); 
    }
    return @result; 
    }sub joindir {
    my ($left, $right) = @_; 
    my $drive = ''; 
    my $root = 0; 
    my (@ls, @rs, $r, $drop_count); 

    if ($left =~ m/^[a-zA-Z]:/) {
    $drive = $left; 
    $drive =~ s/^(..[\/\\]?).*$/\1/; 
    $left  =~ s/^..[\/\\]?(.*)$/\1/; 
    if (substr($drive, -1) eq $sep) {
    $root = 1; 
    substr($drive, -1) = ''; 
    }
    } elsif ($left =~ m/^[\/\\]/) {
    $root = 1; 
    substr($left, 0, 1) = ''; 
    } @ls = path_split($left); 
    @rs = path_split($right);  $drop_count = 0; 
    foreach $r(@rs) {
    if ($r eq '..') {
    if (@ls) {
    $drop_count++; 
    next; 
    }
    }
    last; 
    }
    while ($drop_count--) {
    pop(@ls); 
    shift(@rs); 
    }
    return $drive . ($root ? $sep : '') . join($sep, (@ls, @rs)); 
    }# 
    # print joindir('c:\windows\system32', '..\..\..\..\..\hello\abcdefg'); 
    #sub parse_jsp {
    my ($filename, $outmost) = @_; 
    my ($relpath, $abspath); 
    my $jsp_file;  if ($outmost) {
    # Initialize the current directory
    $curdir = joindir($filename, ".."); 
    } $jsp_file = new FileHandle($filename); 
    if (!$jsp_file) {
    print STDERR "打开文件$filename错误!"; 
    return 0; 
    } my $in_cmt = 0; 
    while (<$jsp_file>) {
    # process comments
    if ($in_cmt) {
    if (m/-->/) {
    s/^.*?-->//;  # remove multi-line comments' ends
    $in_cmt = 0; 
    } else {
    next;  # remove multi-line comments' middles
    }
    }
    s/<!--.*?-->//g;  # remove 1-line comments
    if (m/<!--/) {
    s/<!--.*$//;  # remove multi-line comments' begins
    $in_cmt = 1; 
    } if ($_ =~ m/<%@ +include +file *= *"([^"]*)" *%>/) {
    $relpath = $_; 
    $relpath =~ s/^.*<%@ *include +file *= *"([^"]*)" *%>.*$/\1/; 
    $abspath = joindir($curdir, $relpath); 
    #print STDERR "OPEN \"$relpath\"\n"; 
    if (!parse_jsp($abspath, 0)) {
    print; 
    }
    } else {
    if (!$outmost) {
    $_ =~ s/<%@ *page +contentType[^>]*%>//; 
    $_ =~ s/<%@ *page +language[^>]*%>//; 
    }
    print; 
    }
    }
    close($jsp_file); 
    return 1; 
    }if (!@ARGV) {
    print <<"MARK"; 
    EJIP - Expand JSP Include Pages
    =============================================================
    Syntax: 
    ejip <.jsp file>Author: 
    Danci.Z, March 2004
    MARK
    exit(0); 
    }parse_jsp(shift @ARGV, 1); ----------------------------------------------------------
      

  8.   

    上面,用在win32,如果在unix下,把
    my $sep = "\\"; 
    改成
    my $sep = "/";