<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改密码</title>
</head>
<body>
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=TRSS";
String user="sa";
String password="123";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String s2=request.getParameter("password2");
String s3=request.getParameter("password3");
if(s2==null||s3==null){
response.sendRedirect("updatec.jsp");}
else{
if(s2.equals(s3))
{
String sql="update Ani set pwd='"+request.getParameter("password2")+"' where Sno='"+session.getAttribute("Sno")+"'";
int rows=stmt.executeUpdate(sql);
if(rows>0){
out.print("更新成功");
}
}
else{
out.print("输入的2个新密码不一致!");
response.sendRedirect("updatec.jsp");
}
}
%>
<p><a href="user.jsp"><<您已经更新成功,请返回</a>
<p></body>
</html>
从updatec.jsp要么表单 到这个页面,结果这里password2 和password3 老是接收不到,要怎么做??
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改密码</title>
</head>
<body>
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=TRSS";
String user="sa";
String password="123";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String s2=request.getParameter("password2");
String s3=request.getParameter("password3");
if(s2==null||s3==null){
response.sendRedirect("updatec.jsp");}
else{
if(s2.equals(s3))
{
String sql="update Ani set pwd='"+request.getParameter("password2")+"' where Sno='"+session.getAttribute("Sno")+"'";
int rows=stmt.executeUpdate(sql);
if(rows>0){
out.print("更新成功");
}
}
else{
out.print("输入的2个新密码不一致!");
response.sendRedirect("updatec.jsp");
}
}
%>
<p><a href="user.jsp"><<您已经更新成功,请返回</a>
<p></body>
</html>
从updatec.jsp要么表单 到这个页面,结果这里password2 和password3 老是接收不到,要怎么做??
有的时候SQL server没有打SP4补丁也会引起空指针情况。
也有可能是你的SQL server的1433端口没有打开,在cmd中用netstat检查一下有没有打开
如果没有打开的话,打开它就行了。至于方法google上有很多,你搜一下。
祝你好运,希望你能尽快解决!