当前位置: 代码迷 >> J2EE >> Java web求解,解决办法
  详细解决方案

Java web求解,解决办法

热度:63   发布时间:2016-04-22 01:49:21.0
Java web求解,急急急!!!!!!
我的JSP页面:

<body>
<form action="Ser" method="post">
<table border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#006000">
  <tr bgcolor="#F8FFF7">
  <td colspan="2" bgcolor="#F8FFF7"><div align="center"><font size="4" color="#1D5C92">
  <input name="button222" type="submit" value=" 修改 ">
&nbsp; </font> <font size="4" color="#1D5C92">
<input name="button24" type="button" value=" 返回 ">
</font></div>
 <tr bgcolor="#F6F6F6">
  <td width="78" nowrap bgcolor="#F8FFF7" class="td2">输入账号:</td>
  <td width="232" bgcolor="#F8FFF7"><input type="password" name="id"></td>
  </tr>
  <tr bgcolor="#F6F6F6">
  <td width="78" nowrap bgcolor="#F8FFF7" class="td2">输入原密码:</td>
  <td width="232" bgcolor="#F8FFF7"><input type="password" name="yuan"></td>
  </tr>
  <tr bgcolor="#F6F6F6">
  <td nowrap bgcolor="#F8FFF7" class="td2">输入新密码:</td>
  <td bgcolor="#F8FFF7"><input type="password" name="xin"></td>
  </tr>
  <tr bgcolor="#F6F6F6">
  <td nowrap bgcolor="#F8FFF7" class="td2">确认新密码:</td>
  <td bgcolor="#F8FFF7"><input type="password" name="que"></td>
  </tr>
  
  <tr>
  <td align="center"><input type="submit" name="xiugai" value="修改"/></td>
  <td align="center"><input type="button" name="fanhui" value="返回"/></td>
  </tr>
</table>
</form>
</body>
我的数据连接类:
public class DBunit {


private Connection con;
 
  public Connection getConn()
  { try{Class.forName("com.mysql.jdbc.Driver");
}
catch(ClassNotFoundException e){
System.out.print("加载驱动器有错误");
}
try{con=DriverManager.getConnection("jdbc:mysql://localhost/hr","gxp","gxp");
 
  }
  catch(SQLException el){
  System.out.println("数据库连接有错误");
  } 
   
   
  return con;
  }
  public void setConn(Connection con){
this.con = con;
}
}
我的密码修改处理类:
public class Password {
public String getString(String s) {
  if(s==null) 
  { s= "";} 
  return s;}
public void pass(HttpServletRequest request)
throws SQLException, IOException, ServletException {
// TODO Auto-generated method stub
String id=request.getParameter("id");
id=getString(id);
  String yuan=request.getParameter("yuan");
yuan=getString(yuan);
String xin=request.getParameter("xin");
xin=getString(xin);
String que=request.getParameter("que");
que=getString(que);
 
DBunit db=new DBunit();
db.getConn();
  相关解决方案