查询产品品牌的列表和品牌的详细信息

目录

1.创建一个项目中的src--main-java--com.csi.eshop 下有三个包:

2.main--webapp有:


Session消失的几种方式:客户端和服务器端

  • 客户端
  1. 如果关闭浏览器,在重新打开的时候会导致产生一个新的cookie 同时就会产生一个新的sessionId对象,对于用户来讲,相当于一个新的用户。之前的session就消失了
  2. 关闭浏览器之前的session并没有消失,会保留在服务器中知道过期为止
  • 服务器端
  1. session超时,一段时间之内没有和浏览器做交互的话,此刻的状态就是未交互状态,当时长超过默认的时间或者使用者自定义的时间的 会导致session消失
  2. 用户点击了注销按钮之后,此时的注销按钮调用了session.invalidate()方法,导致当前用户session 注销
  3. 服务器待机或者关闭服务资源, 或者是由于遇到严重错误的时候 也会导致session消失。

1.先编写domain

package com.csi.eshop.domain;

import java.io.Serializable;

public class ProductBrand  implements Serializable {


    private Integer id;
    private String brand_name;
    private String brand_desc;
    private String brand_logo;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getBrand_name() {
        return brand_name;
    }

    public void setBrand_name(String brand_name) {
        this.brand_name = brand_name;
    }

    public String getBrand_desc() {
        return brand_desc;
    }

    public void setBrand_desc(String brand_desc) {
        this.brand_desc = brand_desc;
    }

    public String getBrand_logo() {
        return brand_logo;
    }

    public void setBrand_logo(String brand_logo) {
        this.brand_logo = brand_logo;
    }
}

2.编写dao 中的 接口

package com.csi.eshop.dao;

import com.csi.eshop.domain.Product;
import com.csi.eshop.domain.ProductBrand;

import java.sql.SQLException;
import java.util.List;

public interface ProductBrandDao {

    List<ProductBrand> list() throws SQLException;

    List<Product> findId(int brand_id) throws  SQLException;
}

2.1编写dao 中的 impl

package com.csi.eshop.dao.impl;

import com.csi.eshop.dao.ProductBrandDao;
import com.csi.eshop.domain.Product;
import com.csi.eshop.domain.ProductBrand;
import com.csi.eshop.utils.JDBCUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ProductBrandDaoImpl extends JDBCUtils implements ProductBrandDao {

    @Override
    public List<ProductBrand> list() throws SQLException {

        final String SQL = "SELECT * FROM easybuy_brand" ;

        Connection connection = this.getConnection() ;

        PreparedStatement ps = connection.prepar
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值