• 大小: 10.97MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-08
  • 语言: Java
  • 标签: java  购物网站  

资源简介

基于java设计的购物网站,实现了网上购物浏览商品注册登录等功能,代码简洁界面美观

资源截图

代码片段和文件信息

package com.guigu.action;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.guigu.pojo.Customer;

import com.guigu.service.CustomerService;
import com.guigu.service.impl.CustomerServiceImpl;
import com.guigu.utils.Encrypt;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class CustomerAction extends ActionSupport implements ModelDriven{
private Customer customer=new Customer();
CustomerService customerService=new CustomerServiceImpl();
 

public Customer getModel() {
return customer;
}

 public String logIn(){

HttpServletRequest  request = ServletActionContext.getRequest();
String  userName = request.getParameter(“userName“);
//密码加密
String  pass = Encrypt.md5(request.getParameter(“pass“));
//访问数据库查找有无此用户
customer = customerService.logIn(userNamepass);
System.out.println(customer);
//数据库中有该用户
if(customer != null){
//将用户数据存入session
request.getSession().setAttribute(“customer“customer);
//跳转到商城主页面
return “main“;
}else{
//跳转到重新输入页面
return “fail“;
}

}

public String orderUI(){


return “orderUI“;


}
public String home(){


return “home“;


}

//转发到注册页面
public String registerUI(){
return “registerUI“;
}
//查看协议
public String protocol(){
return “protocol“;
}

//注册校验
public String register(){
HttpServletRequest  request = ServletActionContext.getRequest();
String  userName = request.getParameter(“userName“);
String  pass = Encrypt.md5(request.getParameter(“pass“));
String  email = request.getParameter(“email“);
Boolean reg=customerService.reg(userName pass email);

System.out.println(customer);
if(reg){
customer = customerService.logIn(userNamepass);
request.getSession().setAttribute(“customer“customer);
return “main“;
}
else{
return “failreg“;
}




}
}

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

     文件        706  2017-08-28 10:13  购物商城2.0\E-commerce2.0\.classpath

     文件        913  2017-08-26 21:29  购物商城2.0\E-commerce2.0\.project

     文件        567  2017-08-26 21:29  购物商城2.0\E-commerce2.0\.settings\.jsdtscope

     文件        364  2017-08-26 21:29  购物商城2.0\E-commerce2.0\.settings\org.eclipse.jdt.core.prefs

     文件        558  2017-08-27 15:29  购物商城2.0\E-commerce2.0\.settings\org.eclipse.wst.common.component

     文件        345  2017-08-26 21:29  购物商城2.0\E-commerce2.0\.settings\org.eclipse.wst.common.project.facet.core.xml

     文件         49  2017-08-26 21:29  购物商城2.0\E-commerce2.0\.settings\org.eclipse.wst.jsdt.ui.superType.container

     文件          6  2017-08-26 21:29  购物商城2.0\E-commerce2.0\.settings\org.eclipse.wst.jsdt.ui.superType.name

     文件       1462  2017-08-24 11:08  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\CustomerAction-customerAction_register-validation.xml

     文件       2820  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\CustomerAction.class

     文件       2030  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\CustomerAjaxAction.class

     文件       1544  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\LJAction.class

     文件       2978  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\Order.class

     文件       7998  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\PageAction.class

     文件       1985  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\SellerAction.class

     文件       2527  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\ShoppingcartAction.class

     文件        328  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\Shoppingcart_mainAction.class

     文件       2548  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\ShowObjById.class

     文件       2395  2017-08-27 19:19  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\UserAction-userAction_updateUserById-validation.xml

     文件        687  2017-08-27 19:19  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\UserAction-userAction_updateUserPassById-validation.xml

     文件       3262  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\UserAction.class

     文件       2612  2017-08-27 19:19  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\User_addressAction-addUserAddress-validation.xml

     文件       2612  2017-08-27 19:19  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\User_addressAction-updateUserAddressById-validation.xml

     文件       2586  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\User_addressAction.class

     文件        419  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\action\VisitorAction.class

     文件        271  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\dao\CustomerDao.class

     文件       3050  2017-09-01 13:44  购物商城2.0\E-commerce2.0\build\classes\com\guigu\dao\impl\CustomerDaoImpl.class

     文件      14893  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\dao\impl\LjDaoImpl.class

     文件       1910  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\dao\impl\SellerDaoImpl.class

     文件       4262  2017-09-01 09:37  购物商城2.0\E-commerce2.0\build\classes\com\guigu\dao\impl\ShoppingcartDaoImpl.class

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

评论

共有 条评论