在我的代码中,我想将表“寄存器”中的第四个属性“密码”存储到来自 ResultSet 的变量中,并将其保存在会话中并在另一个页面上使用它。
<%@ page import="java.sql.*" %>
<%
try
{
String eml = request.getParameter("email");
session.setAttribute("to",eml);
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","1234"
Statement st=con.createStatement();
ResultSet rs= st.executeQuery(" select * from register where email='"+eml+"' ");
while(rs.next())
**String psw = rs.getString(4);**
}
**session.setAttribute("pswd",psw);**
response.sendRedirect("sendProcess.jsp");
rs.close();
st.close();
con.close();
}
catch(Exception e){}
%>