Java 實戰(zhàn)項目錘煉之網上花店商城的實現(xiàn)流程
一、項目簡述
功能: 一套完整的網上花店商場系統(tǒng),系統(tǒng)支持前臺會員的注冊 登陸系統(tǒng)留言,花朵的品種選擇,詳情瀏覽,加入購物 車,購買花朵等;后臺支持管理員的花朵種類添加,花朵 詳情的添加修改,用戶管理,留言管理,商場新聞管理等。
二、項目運行
環(huán)境配置: 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;
}
}
到此這篇關于Java 實戰(zhàn)項目錘煉之網上花店商城的實現(xiàn)流程的文章就介紹到這了,更多相關Java 網上花店商城內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
- Java實戰(zhàn)角色權限后臺腳手架系統(tǒng)的實現(xiàn)流程
- Java實戰(zhàn)權限管理系統(tǒng)的實現(xiàn)流程
- Java實戰(zhàn)個人博客系統(tǒng)的實現(xiàn)流程
- Java實戰(zhàn)寵物醫(yī)院預約掛號系統(tǒng)的實現(xiàn)流程
- Java實戰(zhàn)玩具商城的前臺與后臺實現(xiàn)流程
- Java實戰(zhàn)寵物店在線交易平臺的實現(xiàn)流程
- Java實戰(zhàn)網上電子書城的實現(xiàn)流程
- Java實戰(zhàn)項目練習之球館在線預約系統(tǒng)的實現(xiàn)
- Java實戰(zhàn)花店商城系統(tǒng)的實現(xiàn)流程
相關文章
微服務mybatis typehandler使用詳解(就這一篇夠了)
TypeHandler是MyBatis框架的核心組件,實現(xiàn)數據庫表字段類型和Java 數據類型之間的相互轉換,本文介紹通過實例代碼mybatis typehandler使用,感興趣的朋友一起看看吧2024-02-02

