- Java code
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%@include file="dbsconn.jsp"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'Exit.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <META name=VI60_defaultClientScript content=VBScript> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --><%//ID=clientEventHandlersVBS %><SCRIPT LANGUAGE=vbscript>Sub window_onload call settimeout("exitWin",1000,"VBScript")End SubSub exitWin top.location.href="login.jsp"End Sub</SCRIPT> </head> <% Statement st; String sql="insert into UserOpert(UserName,Operation,grade) Values('" +session.getAttribute("UserName") + "','退出系统','" + session.getAttribute("grade") + "')"; st=conn.createStatement(); ResultSet rs=st.executeQuery(sql); while(rs.next()) { //WriteLogDB("退出系统"); session.setAttribute("UserPrivate",""); session.setAttribute("UserId",""); session.setAttribute("grade",""); session.setAttribute("BranchID",""); session.setAttribute("NodeID",""); } rs.close(); st.close(); conn.close(); %> <body> </body></html>
------解决方案--------------------------------------------------------
insert 语句 怎么用 executeQuery 执行查询呢
直接 st.execute(); 返回值是boolean