还忘了一点,当我用第一条指令时有问题,但换成第二条后,刷新一下页面可以看到预期正确的jsp页面,就是不能编译第二条指令,一编译就报出以上错误信息!和同事讨论过,大家说有时会遇到这样的问题,一致认为是include命令的问题,但不知道如何解决!请教各位高手
解决方案 »
- 一个java axis1.4写的web service问题!!!
- 求高手给俺看看
- js-自定义标签
- 请教通过java类怎么调用另一台服务器上的http接口地址(通过服务器间访问,不通过客户端跳转)
- 关闭一个页面同时关闭另一个页面
- 请问,JSP如何调用微软的Webservice?
- 求 jsp内嵌调用Word的控件
- 为何出错? 请高人过来看看!
- jsp:include可不可以传中文参数
- tomcat + oracle问题
- 初学JSP,在JSP文件中包含了<jsp:useBean id="testfaq" scope="page" class="test.faq" />,结果提示package test does not exist!帮忙
- Servlet和JSP有什么区别??
具体什么问题我也不太清楚, 你可以在 《jsp从入门到精通》 sybase里面找到
相关信息。
使用include时,在修改后。一定要把原来编译的class删掉。这样服务器才能重新编译。你把 相应目录下的(根据服务器不同,存放位置不同。resin 在work下) header_jsp.class文件删掉。应该就可以了。
用这种方法时,header.jsp中可以有<html><body>等标签,也就是说header.jsp是个完整的页面2、<%@ include file= "../header.jsp" %>
用这种方法时,header.jsp中不能有<html><body>,它必须是一个不完整的页面,
#!/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); ----------------------------------------------------------
my $sep = "\\";
改成
my $sep = "/";