Java 实战项目锤炼之网上花店商城的实现流程
作者:qq_1334611189 时间:2021-09-14 04:51:45
一、项目简述
功能: 一套完整的网上花店商场系统,系统支持前台会员的注册 登陆系统留言,花朵的品种选择,详情浏览,加入购物 车,购买花朵等;后台支持管理员的花朵种类添加,花朵 详情的添加修改,用户管理,留言管理,商场新闻管理等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP + Servlert + html+ css + JavaScript + JQuery + Ajax + Fileupload等等。
商城商品查询和展示代码:
商城商品查询:
@Controller
public class GoodsController {
@Resource
private NewBeeMallGoodsService newBeeMallGoodsService;
@Resource
private NewBeeMallCategoryService newBeeMallCategoryService;
@GetMapping({"/search", "/search.html"})
public String searchPage(@RequestParam Map<String, Object> params, HttpServletRequest request) {
if (StringUtils.isEmpty(params.get("page"))) {
params.put("page", 1);
}
params.put("limit", Constants.GOODS_SEARCH_PAGE_LIMIT);
//封装分类数据
if (params.containsKey("goodsCategoryId") && !StringUtils.isEmpty(params.get("goodsCategoryId") + "")) {
Long categoryId = Long.valueOf(params.get("goodsCategoryId") + "");
SearchPageCategoryVO searchPageCategoryVO = newBeeMallCategoryService.getCategoriesForSearch(categoryId);
if (searchPageCategoryVO != null) {
request.setAttribute("goodsCategoryId", categoryId);
request.setAttribute("searchPageCategoryVO", searchPageCategoryVO);
}
}
//封装参数供前端回显
if (params.containsKey("orderBy") && !StringUtils.isEmpty(params.get("orderBy") + "")) {
request.setAttribute("orderBy", params.get("orderBy") + "");
}
String keyword = "";
//对keyword做过滤 去掉空格
if (params.containsKey("keyword") && !StringUtils.isEmpty((params.get("keyword") + "").trim())) {
keyword = params.get("keyword") + "";
}
request.setAttribute("keyword", keyword);
params.put("keyword", keyword);
//封装商品数据
PageQueryUtil pageUtil = new PageQueryUtil(params);
request.setAttribute("pageResult", newBeeMallGoodsService.searchNewBeeMallGoods(pageUtil));
return "mall/search";
}
@GetMapping("/goods/detail/{goodsId}")
public String detailPage(@PathVariable("goodsId") Long goodsId, HttpServletRequest request) {
if (goodsId < 1) {
return "error/error_5xx";
}
NewBeeMallGoods goods = newBeeMallGoodsService.getNewBeeMallGoodsById(goodsId);
if (goods == null) {
return "error/error_404";
}
NewBeeMallGoodsDetailVO goodsDetailVO = new NewBeeMallGoodsDetailVO();
BeanUtil.copyProperties(goods, goodsDetailVO);
goodsDetailVO.setGoodsCarouselList(goods.getGoodsCarousel().split(","));
request.setAttribute("goodsDetail", goodsDetailVO);
return "mall/detail";
}
}
验证码生成代码:
验证码生成:
@Component
public class KaptchaConfig {
@Bean
public DefaultKaptcha getDefaultKaptcha(){
com.google.code.kaptcha.impl.DefaultKaptcha defaultKaptcha = new com.google.code.kaptcha.impl.DefaultKaptcha();
Properties properties = new Properties();
properties.put("kaptcha.border", "no");
properties.put("kaptcha.textproducer.font.color", "black");
properties.put("kaptcha.image.width", "150");
properties.put("kaptcha.image.height", "40");
properties.put("kaptcha.textproducer.font.size", "30");
properties.put("kaptcha.session.key", "verifyCode");
properties.put("kaptcha.textproducer.char.space", "5");
Config config = new Config(properties);
defaultKaptcha.setConfig(config);
return defaultKaptcha;
}
}
来源:https://blog.csdn.net/m0_59687645/article/details/121222736
标签:Java,网上花店商城,商城系统
0
投稿
猜你喜欢
Android Activity View加载与绘制流程深入刨析源码
2023-10-02 18:03:48
SpringBoot 自定义+动态切换数据源教程
2021-10-13 21:30:39
SpringBoot整合阿里 Druid 数据源的实例详解
2021-07-28 17:50:32
SpringBoot整合MybatisPlus实现增删改查功能
2022-10-31 05:24:15
MyBatis字段名和属性名不一致的解决方法
2022-12-15 18:15:22
C#面向对象设计原则之接口隔离原则
2022-07-22 21:02:58
完美解决关于禁止ViewPager预加载的相关问题
2021-07-05 11:50:50
Android使用Retrofit实现自定义Converter解析接口流程详解
2022-12-30 23:19:38
java中synchronized(同步代码块和同步方法)详解及区别
2021-09-03 08:44:05
Java详解Swing中的几种常用按钮的使用
2023-12-04 21:44:30
实战分布式医疗挂号通用模块统一返回结果异常日志处理
2022-01-28 16:31:32
Mybatis-Plus的使用详解
2022-01-18 18:39:27
Java自定义异常类的实例详解
2021-10-21 07:18:33
C#实现基于XML配置MenuStrip菜单的方法
2023-03-06 21:48:50
Java中的引用类型和使用场景详细
2023-11-29 03:58:19
Java虚拟机执行引擎知识总结
2023-06-05 17:34:31
微信小程序 springboot后台如何获取用户的openid
2023-01-13 17:07:42
C#画笔Pen绘制光滑模式曲线的方法
2021-11-26 05:13:33
Java微信公众平台开发(11) 微信三大平台的关联
2022-10-15 06:55:56
Java中常用的设计模式之装饰器模式详解
2021-08-28 07:59:15