TOMCAT日志报以上错误。
代码如下<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=GBK" import="">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title></title>
<link href="/style/css.css" rel="stylesheet" type="text/css">
</head>
<%
String id = request.getParameter("id")==null?"":request.getParameter("id").trim();
for(int i=0;i<id.length();i++){
String substring=id.substring(i,i+1);
if(("0123456789").indexOf(substring)==-1){
out.print("<script language='javascript'>");
out.print("alert('您要的网页不存在,请与网站管理员联系!');");
out.print("history.go(-1);");
out.print("</script>");
out.close();//是不是我在这里用了关闭才导致那个错误的。
}
}
CompanyManagerImpl manager = new CompanyManagerImpl();
CompanyModel model = manager.getCompanyInfoListById(id);
if(model==null){
out.print("<script language='javascript'>");
out.print("alert('您要的网页不存在,请与网站管理员联系!');");
out.print("history.go(-1);");
out.print("</script>");
out.close();
}
ShengManagerImpl shengManager = new ShengManagerImpl();
ShiManagerImpl shiManager = new ShiManagerImpl();
String shengId=model.getShengId()+"";
String shiId = model.getShiId()+"";
String shengName = shengManager.getShengNameById(shengId);
String shiName = shiManager.getShiNameById(shiId);
%>
<body bgcolor="F4F9FE" leftmargin="0" topmargin="0">
<table width="66%" height="519" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="46" colspan="3" valign="bottom"><img src="/map/head.gif" width="678" height="46"></td>
</tr>
<tr>
代码如下<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=GBK" import="">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title></title>
<link href="/style/css.css" rel="stylesheet" type="text/css">
</head>
<%
String id = request.getParameter("id")==null?"":request.getParameter("id").trim();
for(int i=0;i<id.length();i++){
String substring=id.substring(i,i+1);
if(("0123456789").indexOf(substring)==-1){
out.print("<script language='javascript'>");
out.print("alert('您要的网页不存在,请与网站管理员联系!');");
out.print("history.go(-1);");
out.print("</script>");
out.close();//是不是我在这里用了关闭才导致那个错误的。
}
}
CompanyManagerImpl manager = new CompanyManagerImpl();
CompanyModel model = manager.getCompanyInfoListById(id);
if(model==null){
out.print("<script language='javascript'>");
out.print("alert('您要的网页不存在,请与网站管理员联系!');");
out.print("history.go(-1);");
out.print("</script>");
out.close();
}
ShengManagerImpl shengManager = new ShengManagerImpl();
ShiManagerImpl shiManager = new ShiManagerImpl();
String shengId=model.getShengId()+"";
String shiId = model.getShiId()+"";
String shengName = shengManager.getShengNameById(shengId);
String shiName = shiManager.getShiNameById(shiId);
%>
<body bgcolor="F4F9FE" leftmargin="0" topmargin="0">
<table width="66%" height="519" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="46" colspan="3" valign="bottom"><img src="/map/head.gif" width="678" height="46"></td>
</tr>
<tr>
整个输出流就被关闭了,后面的out都会报错,包括后面的html标签的输出
其实也是out.println();
建议楼主看看jsp编译后的java文件就明白了
删掉这个
支持,你需要将你的这两句out.close();都改为return;其实更好的办法是将页面的跳转放在Action中,也就是控制层,放在页面中感觉比较乱。
我把out.close();
弄掉,不加return报错。
有的地方又删除是可以的,加上return反而报错。
什么原因????