新巴巴运动网 项目第三天

新巴巴运动网 项目第三天

 

 

  1. 今天内容

  1. Dubbo优化
  2. 搭建后台管理页面
  3. 品牌管理 列表查询(带条件 + 分页)
  4. 品牌管理 去修改页面
  5. 品牌管理 异步上传图片
    1. Dubbo优化

 

  1. 超时

 

 

 

 

 

 

  1. 服务消费方通过注册中心获取服务提供方的地址、调用服务提供方、由于服务提供方可能已经宕机、不能提供服务
  2. 服务消费方在1秒内没有得到回应、为了给用户提供非常服务、马上与服务提供方断开连接、再向注册中心获取新的服务提供方的地址、调用新的服务提供方
  3. Dubbo用此方法来完成分布式情况下、服务器出现故障、而不影响用户的访问

 

 

 

 

 

  1. 直接连接

 

 

服务提供方地址

192.168.79.100:20880

正确

127.0.0.1:20880

 

服务消费方直接连接

 

 

 

  1. 服务消费方不检查 服务提供方

 

 

 

 

 

  1. 搭建后台管理页面

  1. 页面原型位置

 

 

  1. Springmvc配置

 

  1. 入口页面

/WEB-INF/console/index.jsp

 

  1. 跳转入口页面的程序

在CenterController中

 

  1. 商品模块入口

  1. 商品模块入口路径设置

  1. top.jsp中

 

  1. CenterController中

  1. POST提交(乱码)

  1. 统一处理空串及空串串

去掉前后空格、

例如:

页面上传递的参数前面或后面都有空串,需要去掉

页面上传递的参数为空串时,也需要转成Null

  1. 配置Conveter转换器的工厂

Springmvc中配置

  1. 自定义类(转换的类)

 

 

  1. 品牌管理之列表查询

    1. 品牌表

DROP TABLE IF EXISTS `bbs_brand`;

CREATE TABLE `bbs_brand` (

`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',

`name` varchar(40) NOT NULL COMMENT '名称',

`description` varchar(80) DEFAULT NULL COMMENT '描述',

`img_url` varchar(80) DEFAULT NULL COMMENT '图片Url',

`web_site` varchar(80) DEFAULT NULL COMMENT '品牌网址',

`sort` int(11) DEFAULT NULL COMMENT '排序:最大最排前',

`is_display` tinyint(1) DEFAULT NULL COMMENT '是否可见 1:可见 0:不可见',

PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='品牌';

 

 

 

Int 10亿

Bigint 10亿亿

Tingint -128~127

INSERT INTO bbs_brand VALUES ('1', '依琦莲', null, null, null, '99', '1');

INSERT INTO bbs_brand VALUES ('2', '凯速(KANSOON', null, null, null, 98, '1');

INSERT INTO bbs_brand VALUES ('3', '梵歌纳(vangona', null, null, null, 97, '1');

INSERT INTO bbs_brand VALUES ('4', '伊朵莲', null, null, null, 96, '1');

INSERT INTO bbs_brand VALUES ('5', '菩媞', null, null, null, 95, '1');

INSERT INTO bbs_brand VALUES ('6', '丹璐斯', null, null, null, 94, '1');

INSERT INTO bbs_brand VALUES ('7', '喜悦瑜伽', null, null, null, 93, '1');

INSERT INTO bbs_brand VALUES ('8', '皮尔(pieryoga', null, null, null, 92, '1');

INSERT INTO bbs_brand VALUES ('9', '路伊梵(LEFAN', null, null, null, 91, '1');

INSERT INTO bbs_brand VALUES ('10', '金啦啦', null, null, null, 90, '0');

INSERT INTO bbs_brand VALUES ('11', '来尔瑜伽(LaiErYoGA', null, null, null, 89, '1');

INSERT INTO bbs_brand VALUES ('12', '艾米达(aimida', null, null, null, 88, '1');

INSERT INTO bbs_brand VALUES ('13', '斯泊恩', null, null, null, 87, '1');

INSERT INTO bbs_brand VALUES ('14', '康愫雅KSUA', null, null, null, 86, '1');

INSERT INTO bbs_brand VALUES ('15', '格宁', null, null, null, 85, '1');

INSERT INTO bbs_brand VALUES ('16', 'E奈尔(Enaier', null, null, null, 84, '1');

INSERT INTO bbs_brand VALUES ('17', '哈他', null, null, null, 83, '1');

INSERT INTO bbs_brand VALUES ('18', '伽美斯(Jamars', null, null, null, 82, '1');

INSERT INTO bbs_brand VALUES ('19', '瑜伽树(yogatree', null, null, null, 81, '1');

INSERT INTO bbs_brand VALUES ('20', '兰博伊人(lanboyiren', null, null, null, 80, '1');

 

 

 

 

  1. 品牌POJO

/**

* 品牌

* @author lx

*

*/

public class Brand implements Serializable{

 

    /**

     * 默认的ID

     */

    private static final long serialVersionUID = 1L;

    

    //品牌ID bigint

    private Long id;

    //品牌名称

    private String name;

    //描述

    private String description;

    //图片URL

    private String imgUrl;

    //排序 越大越靠前

    private Integer sort;

    //是否可用 0 不可用 1 可用

    private Integer isDisplay;//is_display

 

  1. 查询列表

 

  1. 需求说明

  1. 点击品牌管理 –>右侧跳转到品牌列表页面 无条件
  2. 点击查询按钮 —>刷新品牌列表页面 条件:品牌名称 是否可见
  3. 点击分页页号 à加载相应页面的数据 带上查询条件
    1. 品牌管理入口的路径

/brand/list.do

 

入参 : 无 (默认 是(可见))

 

  1. Dao

入参:BrandQuery 对象

返回值:结果集 品牌

 

 

 

  1. Mapper

  1. BrandService

入参:品牌名称 是否可见

返回值:结果集 品牌

 

 

 

  1. BrandController

 

入参: 品牌名称 是否可见

返回值:结果集 品牌

跳转视图 brand/list

 

 

 

  1. 页面

回显数据

 

 

 

  1. 回显查询条件

 

 

 

  1. 品牌管理之列表查询(分页)

分页源码

  1. BrandQuery

 

  1. Dao

  1. Mapper

 

 

 

  1. BrandService

入参:当前页 名称 是否可用

返回值:分页对象 (里面有品牌结果集)

  1. BrandController

入参:当前页 名称 是否可用

返回值:分页对象 (里面有品牌结果集)

跳转视图 不变

 

 

 

  1. 页面遍历分页对象

 

 

 

  1. 页面 分页 A标签

路径

<a onclick=window.location.href='/brand/list.do?&isDisplay=1&pageNo=2'>2</a>

<a onclick=window.location.href='/brand/list.do?name=依&isDisplay=1&pageNo=2'>2</a>

 

<a onclick=window.location.href='/brand/list.do?name=依&isDisplay=1&pageNo=2'>2</a>

 

<a onclick=window.location.href='/brand/list.do?name=依&isDisplay=1&pageNo=2'>2</a>

 

<a onclick=window.location.href='/brand/list.do?name=依&isDisplay=1&pageNo=2'>2</a>

 

 

 

 

  1. Get请求乱码

 

 

 

 

Server.xml

 

  1. 品牌管理之修改

    1. 去修改页面

设置路径

/brand/toEdit.do?id=${brand.id}

 

 

 

  1. Dao

  1. Mapper

  1. Service

 

  1. Controller

  1. 页面回显

 

  1. 上传图片

    1. 保存图片的位置

 

  1. 页面

 

 

 

 

  1. Springmvc 配置支持上传图片

 

 

  1. UploadController 接收图片

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

      

 

posted @ 2017-01-12 13:26  beyondcj  阅读(1608)  评论(0编辑  收藏  举报