reg.jsp表单提交后,由regok.jsp验证,若没有重名,就将数据插入到数据库user表中。然后将页面转到index.jsp。但是老是出现“Internet Explorer 无法显示该网页”的错误。大侠帮帮忙,这是为什么?
- Java code
<%@ page contentType="text/html;charset=gb2312" %><%@ include file="conn.jsp"%><%@ page import="java.sql.*"%><%! String face,nick,code,code1,sex,email,qq;%><% //从注册页面获得用户注册信息 String nich= request.getParameter("nich"); String mima= request.getParameter("mima"); String sex= request.getParameter("sex"); String email= request.getParameter("email"); String qq=request.getParameter("qq"); String truename=request.getParameter("truename"); String sidclass=request.getParameter("sidclass"); String cardnum=request.getParameter("cardnum"); String edudegree=request.getParameter("edudegree"); String nationality=request.getParameter("nationality"); String intro=request.getParameter("intro"); String sqlUser = "select * from user where name='" +nich+"'"; rs.next(); if(rs != null){ response.sendRedirect("reg.jsp?msg=用户已经存在,请重新选择用户名进行注册!"); }else{ //新用户记录 Statement stmt_ADD=conn.createStatement(); String Sql="insert into user(nich,mima,truename,sidclass," + "cardnum,sex,edudegree," + "nationality,email,qq," + "intro) values ('" + nich + "','" + mima+"','"+ truename+"','"+sidclass+"','"+cardnum+"','" + sex+"','"+edudegree+"','" + nationality + "','" + email + "','" + qq + "','" + intro+"')"; int add1=stmt_ADD.executeUpdate(Sql); if (add1>0){ System.out.print("用户:["+ nich +"] 注册成功"); session.setAttribute("loginuser",nich); response.sendRedirect("index.jsp"); }else { System.out.print("注册失败,请重新注册!"); response.sendRedirect("reg.jsp"); } stmt_ADD.close(); } stmt.close() ; %>
------解决方案--------------------
先输出一个sql语句,然后再输出add1,看是不是你想要的
------解决方案--------------------
------解决方案--------------------
String url="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+request.getRealPath("/")+"7dy311/db1.mdb";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
------解决方案--------------------
对不起,没看见10搂的