你是这样用吗?
<jsp:forward page="load.jsp?url=manage_dpt.jsp"/>
Welcome to 闪龙:[flash反编专家]
http://www.flashlong.com
http://www.flashlong.com/bbs
<jsp:forward page="load.jsp?url=manage_dpt.jsp"/>
Welcome to 闪龙:[flash反编专家]
http://www.flashlong.com
http://www.flashlong.com/bbs
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<!--%@ page import="DbAccess.*"%--><jsp:useBean id="connBean" scope="page" class="cn.edu.shu.cims.printing.common.DBConnBean"/>
<jsp:useBean id="queryBean" scope="page" class="cn.edu.shu.cims.printing.common.DatabaseQuery"/><%
String querySQL = "select * from EMP";
String nextPage;
Connection conn=null;
conn=connBean.getConnect();
if(conn == null)
{
//nextPage="../../errors/DbConnError.jsp";
nextPage="../../index.jsp";
out.println("conn is error");
%>
<jsp:forward page="<%= nextPage %>" />
<%
}
%>
<%
queryBean.init(conn, request, 10, querySQL);
%>
后面是关于不为空的处理
我这边帮你调试一下
if(conn == null)
{
//nextPage="../../errors/DbConnError.jsp";
nextPage="../../index.jsp";
//out.println("conn is error");
response.sendRedirect(nextPage);
return;
}这样也把<%%>省了,注意:return语句一定要加,不然程序会继续执行的。
if(conn == null)
{
//nextPage="../../errors/DbConnError.jsp";
nextPage="../../index.jsp";
//out.println("conn is error");
response.sendRedirect(nextPage);
return;
}这样也把<%%>省了,注意:return语句一定要加,不然程序会继续执行的。
return;
语句,body部分为空,不转向也不报错了。
DBProcess DB = new DBProcess();
if ( !DB.connectDatabase() ) //判断数据库连接成功
{
%>
<jsp:forward page="data_err.jsp"/>
<%
return;
}
session.setAttribute("dbprocess",DB);
if (!DB.addUserRecord(s1,s2,s3,s4,s5,s6,s7,s8,s9)) //添加数据到数据库
{
%>
<jsp:forward page="reg_user_err.jsp"/> //如果用户已存在,返回页面错误.
<%
return;
}
%>
<jsp:forward page="reg_user_ok.jsp"/> // 注册用户成功;