java.lang.IllegalStateException: getOutputStream() has already been called for this response

<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Welcome BreakingFree论坛</title>
<link rel=stylesheet type=text/css href="./lib/bbs.css">
<jsp:useBean scope="page" id="User" class="com.breakingfree.User" />
</head>
<body background="image/2.jpg">
<table align="center"width="90%" higth="30%" >
<tr>
<td width="50%" height="30" align="right"></td>
<td width="50%" height="30" align="left"></td>
</tr>
<tr>
<td width="50%" height="30" align="right"></td>
<td width="50%" height="30" align="left"></td>
</tr>
<tr>
<td width="100%" height="40" align="center" colspan="2">

</td>
</tr>
</table>
<div align="center">
<h1> BreakingFree论坛用户注册</h1>
<%
//定义是否注册成功的变量
boolean isSuc = false;
//定义编码格式
request.setCharacterEncoding("gb2312");
//获取验证码信息
String sRand1 = (String)session.getAttribute("Rand");
String sRand2 = request.getParameter("Rand");
//判断填写的验证码是否正确
if (sRand1.compareTo(sRand2)==0)
{
//获取所要注册的用户名
String sUserName = request.getParameter("UserName");
out.println(sUserName+1);
User.setUserName(sUserName);
//判断该用户名是否已经存在
if(User.exist())
out.println("<p>用户名 <font color=red>"+sUserName+"</font> 已经存在!</p>");
else
{
out.println(sUserName+2);
//获取其他注册信息
String sUserPassword = request.getParameter("UserPassword");
String sNickName = request.getParameter("NickName");
String sSex = request.getParameter("Sex");
String sEmail = request.getParameter("Email");
User.setUserPassword(sUserPassword);
User.setNickName(sNickName);
User.setSex(sSex);
User.setEmail(sEmail);
//保存注册信息
if(User.add())
{
isSuc = true;
out.println("<p align=center><font color=blue>用户注册成功</font></p>");
}
else
out.println("<p><font color=red>用户注册失败,请稍后重试</font></p>");
}
}
else
out.println("<p><font color=red>您输入的验证码错误</font></p>");

//输出跳转目的页面信息
if(isSuc)
out.println("<p><input type=button name=btn value=\" 登录 \" onClick=\"window.location='index.html'\"></p>");
else
out.println("<p><input type=button name=btn value=\" 返回 \" onClick='window.history.go(-1)'></p>");
out.flush();
//移除验证码信息
session.removeAttribute("Rand");
%>
</div>
</body>
</html>
就是每次都是这个错误,插入不近数据库里!我弄不明白想问问你们高手!

第1个回答  2008-05-16
你在问什么??

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网