• 大小: 7.47MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-23
  • 语言: Java
  • 标签: 购物  

资源简介

这是一个小型的JSP购物网站,比较适合学生毕设参考.................

资源截图

代码片段和文件信息

package szy.shopping.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import szy.shopping.entity.Admin;

public class AdminDAO {
Connection con;
PreparedStatement pstm;
ResultSet rs;

public AdminDAO(){
Initialization initialization=new Initialization();
con=initialization.init();
}
//查询管理员密码是否正确
public boolean checkAdmin(Admin admin){
boolean result=false;
try {
pstm=con.prepareStatement(“select * from Admin where userName=? and password=?“);
pstm.setobject(1 admin.getUserName());
pstm.setobject(2 admin.getPassword());
rs=pstm.executeQuery();
if(rs.next())  //存在结果
result=true;
destroy();
} catch (Exception e) {
System.err.println(“AdminDAO.checkAdmin ERROR ## “+e.getMessage());
}
return result;
}
//修改密码
public boolean changePassword(String userNameString newPassword){
boolean result=false;
try {
pstm=con.prepareStatement(“update admin set password=? where userName=?“);
pstm.setobject(1 newPassword);
pstm.setobject(2 userName);
pstm.execute();
result=true;
destroy();
} catch (Exception e) {
System.err.println(“AdminDAO.changePassword ERROR ## “+e.getMessage());
}
return result;

//添加新客户
public boolean addNewAdmin(Admin admin){
boolean result=false;
try {
pstm=con.prepareStatement(“insert into Admin values(??)“);
pstm.setobject(1 admin.getUserName());
pstm.setobject(2 admin.getPassword());
pstm.execute();
result=true;
destroy();
} catch (Exception e) {
System.err.println(“AdminDAO.addNewAdmin ERROR ## “+e.getMessage());
}
return result;
}

//释放资源
private void destroy(){
try {
if(rs!=null){
rs.close();
}
if(pstm!=null){
pstm.close();
}
if(con!=null){
con.close();
}
} catch (Exception e) {
System.out.println(“CustomerDAO.destroy ERROR ## “+e.getMessage());
}
}
//
// public static void main(String[] args) {
// //AdminDAO admin=new AdminDAO();
// //System.out.println(admin.checkAdmin(“admin“ “admin“));
// //System.out.println(admin.changePassword(“admin“ “admin“));
// //System.out.println(admin.addNewAdmin(“coolszy“ “kuka“));
// }

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        548  2018-02-22 00:33  shopping\.classpath

     文件       1041  2009-05-04 21:19  shopping\.project

     文件        454  2009-05-04 21:19  shopping\.settings\.jsdtscope

     文件        330  2009-05-04 21:19  shopping\.settings\org.eclipse.jdt.core.prefs

     文件        364  2009-05-04 21:19  shopping\.settings\org.eclipse.jst.common.project.facet.core.prefs

     文件        422  2009-05-04 21:19  shopping\.settings\org.eclipse.wst.common.component

     文件        320  2009-05-04 21:19  shopping\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2009-05-04 21:19  shopping\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2009-05-04 21:19  shopping\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       1363  2009-05-29 15:35  shopping\build\classes\displaytag_zh_CN.properties

     文件       2913  2018-02-22 19:34  shopping\build\classes\szy\shopping\dao\AdminDAO.class

     文件       4865  2018-02-22 19:34  shopping\build\classes\szy\shopping\dao\CustomerDAO.class

     文件       7696  2018-02-22 19:34  shopping\build\classes\szy\shopping\dao\GoodsDAO.class

     文件       1303  2018-02-22 19:34  shopping\build\classes\szy\shopping\dao\Initialization.class

     文件       3132  2018-02-22 19:34  shopping\build\classes\szy\shopping\dao\MessageDAO.class

     文件       4461  2018-02-22 19:34  shopping\build\classes\szy\shopping\dao\OrderFormDAO.class

     文件       6218  2018-02-22 19:34  shopping\build\classes\szy\shopping\dao\ShoppingCarDAO.class

     文件       1113  2018-02-22 19:34  shopping\build\classes\szy\shopping\entity\Admin.class

     文件       1450  2018-02-22 19:34  shopping\build\classes\szy\shopping\entity\CarGoodsDetails.class

     文件       1632  2018-02-22 19:34  shopping\build\classes\szy\shopping\entity\Customer.class

     文件       2174  2018-02-22 19:34  shopping\build\classes\szy\shopping\entity\Goods.class

     文件       1870  2018-02-22 19:34  shopping\build\classes\szy\shopping\entity\Message.class

     文件       1247  2018-02-22 19:34  shopping\build\classes\szy\shopping\entity\OrderForm.class

     文件       1453  2018-02-22 19:34  shopping\build\classes\szy\shopping\entity\OrderFormDetails.class

     文件       2131  2018-02-22 19:34  shopping\build\classes\szy\shopping\filter\AdminFilter.class

     文件       1208  2018-02-22 19:34  shopping\build\classes\szy\shopping\otherclasses\ChangeEncoding.class

     文件       2610  2018-02-22 19:34  shopping\build\classes\szy\shopping\services\AdminService.class

     文件       5172  2018-02-22 19:34  shopping\build\classes\szy\shopping\services\CustomerServices.class

     文件       1672  2018-02-22 19:34  shopping\build\classes\szy\shopping\services\GoodsServices.class

     文件       2553  2018-02-22 19:34  shopping\build\classes\szy\shopping\servlet\admin\AddCustomerServlet.class

............此处省略329个文件信息

评论

共有 条评论