新手在线等待,这一行代表什么意思那。 导入下面java代码要用到的包! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <%@page import="java.util.*, java.text.*, java.sql.*, com._21cn.sql.*"%><%@page contentType="text/html;charset=gb2312" %><%//检查用户是否已经登陆HttpSession Session = request.getSession(true);String ss_user_id = (String)Session.getValue("SS_USER_ID");if(ss_user_id == null){ response.sendRedirect("m_login.jsp"); return;}String DOWHAT = request.getParameter("DOWHAT");String MSG = "";if(DOWHAT != null && DOWHAT.equals("CHPWD")){ Connection conn = null; Statement pstmt = null; try{ conn = DBFactory.getConnection(); //建立数据库连接 pstmt = conn.createStatement(); //检查原来的密码 String sql = "select * from iyhf_user "; sql += " where user_id=" + ss_user_id; sql += " and passwd='" + request.getParameter("f_old_pwd") + "'"; ResultSet rs = pstmt.executeQuery(sql); if(rs.next()){ sql = "update iyhf_user set passwd='" + request.getParameter("f_new_pwd") + "'"; sql += " where user_id=" + ss_user_id; if(pstmt.executeUpdate(sql) == 1){ MSG = "修改密码成功!"; } else{ MSG = "修改密码失败!"; } } else{ MSG = "密码输入错误,不能修改密码!"; } }catch(SQLException e){ out.println("数据库操作失败!"); e.printStackTrace(); }finally{ //关闭数据库连接 try { pstmt.close(); } catch (Exception e) { e.printStackTrace(); } try { conn.close(); } catch (Exception e) { e.printStackTrace(); } }}%>整个页面代码是这样的,我可以看到数据库链接名称、库名、用户名和密码吗 不能看到数据库链接名称、库名、用户名和密码!!!conn = DBFactory.getConnection(); //建立数据库连接上面这个函数里面已经做了连接。除非你有这个包com._21cn.sql.*的源程序!DBFactory应该是这个包的啦。 和:JAVA中的 import java.util.*;import java.text.*;import java.sql.*;...是一个意思,他是在网页中的格式!! JSTL foreach如何嵌套输出 struts框架Servlet action is not available JSP对于特殊字符要怎么处理? jsp多表查询分页 dreamweaver+mysql 报错 关于TELNET到TOMCAT服务器上的超时问题 java写入word时怎样让字符串在word中换行? 怎样在JSP中显示已经查询出来的历史记录?(仔细看下内容) ./和../有什么不同? 这样写为什么不能将数值转化成字符串? 再一个jsp页面中如何嵌入一个可执行的远端jsp程序? 新手问题~~
java.text.*,
java.sql.*,
com._21cn.sql.*"
%>
<%@page contentType="text/html;charset=gb2312" %>
<%
//检查用户是否已经登陆
HttpSession Session = request.getSession(true);
String ss_user_id = (String)Session.getValue("SS_USER_ID");
if(ss_user_id == null){
response.sendRedirect("m_login.jsp");
return;
}String DOWHAT = request.getParameter("DOWHAT");
String MSG = "";if(DOWHAT != null && DOWHAT.equals("CHPWD")){
Connection conn = null;
Statement pstmt = null;
try{
conn = DBFactory.getConnection(); //建立数据库连接
pstmt = conn.createStatement();
//检查原来的密码
String sql = "select * from iyhf_user ";
sql += " where user_id=" + ss_user_id;
sql += " and passwd='" + request.getParameter("f_old_pwd") + "'";
ResultSet rs = pstmt.executeQuery(sql);
if(rs.next()){
sql = "update iyhf_user set passwd='" + request.getParameter("f_new_pwd") + "'";
sql += " where user_id=" + ss_user_id;
if(pstmt.executeUpdate(sql) == 1){
MSG = "修改密码成功!";
}
else{
MSG = "修改密码失败!";
}
}
else{
MSG = "密码输入错误,不能修改密码!";
}
}catch(SQLException e){
out.println("数据库操作失败!");
e.printStackTrace();
}finally{ //关闭数据库连接
try { pstmt.close(); }
catch (Exception e) { e.printStackTrace(); }
try { conn.close(); }
catch (Exception e) { e.printStackTrace(); }
}
}
%>
整个页面代码是这样的,我可以看到数据库链接名称、库名、用户名和密码吗
conn = DBFactory.getConnection(); //建立数据库连接
上面这个函数里面已经做了连接。
除非你有这个包com._21cn.sql.*的源程序!DBFactory应该是这个包的啦。
import java.util.*;
import java.text.*;
import java.sql.*;...是一个意思,他是在网页中的格式!!