首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

奇怪的异常

2012-03-14 
奇怪的错误做一个登录的功能,转向页面index.jspout.println(登陆成功)session.setMaxInactiveInterval(

奇怪的错误

做一个登录的功能,转向页面index.jsp

out.println("登陆成功");
  session.setMaxInactiveInterval(60000);
  session.setAttribute("username",username);
  String userid = rs.getString("userid");
  session.setAttribute("userid", "userid");
  session.setAttribute("fullname", rs.getString("fullname"));
  session.setAttribute("logins", rs.getString("logins"));
  session.setAttribute("rights", rs.getString("rights"));
  session.setAttribute("depid", rs.getString("depid"));
  session.setAttribute("mygroups", rs.getString("groups"));
 
  String lastip = req.getRemoteAddr();
  String update = "UPDATE userinfo SET lastlogin='" + date.toLocaleString() + "',logins=logins+1 where userid=" + userid;
  String update1 = "INSERT into Log(username,uptime,lastip,content) VALUES('" + username + "','" + date.toLocaleString() + "','" + lastip + "','登陆系统')";
 
  int n = sql1.executeUpdate(update1);
  int f = sql1.executeUpdate(update);
 
  resp.sendRedirect("index.jsp");

结果并没有执行到index.jsp
后台也没报错
前台只显示了登录成功
数据库内没有内容(oracle)

请问是什么问题?

session.setMaxInactiveInterval(60000);设置断点调试的内容大致如下,但是没看到问题

thisLogin (id=61)
reqRequestFacade (id=66)
respResponseFacade (id=70)
outCoyoteWriter (id=74)
sessionStandardSessionFacade (id=81)
username"admin" (id=83)
pwd"admin" (id=88)
searchinfo"select * from userinfo where username=? and pwd=?" (id=94)
bootrue
dateDate (id=99)
connOracleConnection (id=85)
sql1OracleStatement (id=101)
sqlOraclePreparedStatement (id=108)
rsOracleResultSetImpl (id=112)
mtrue
userid"1" (id=183)
lastip"127.0.0.1" (id=184)
update"UPDATE userinfo SET lastlogin='2012-2-23 22:37:33',logins=logins+1 where userid=1" (id=185)
update1"INSERT into Log(username,uptime,lastip,content) VALUES('admin','2012-2-23 22:37:33','127.0.0.1','登陆系统')" (id=186)


求帮助



[解决办法]

探讨
关键问题在:“out.println("登陆成功");”

一旦你向浏览器发送了任何内容后,就不能再发送sendRedirect了,或者说发送了也没效果了。

热点排行
Bad Request.