csj2018

1.后端

1.1 controller层

package com.csj2018.o2o.web.frontend;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.csj2018.o2o.entity.Product;
import com.csj2018.o2o.service.ProductService;
import com.csj2018.o2o.util.HttpServletRequestUtil;

@Controller
@RequestMapping(value="/frontend")
public class ProductDetailController {
	@Autowired
	private ProductService productService;
	
	@RequestMapping(value="/listproductdetailpageinfo",method=RequestMethod.GET)
	@ResponseBody
	private Map<String,Object> showProductDetail(HttpServletRequest request){
		Map<String,Object> modelMap = new HashMap<String,Object>();
		//获取前台传过来的productId
		long productId = HttpServletRequestUtil.getLong(request, "productId");
		Product product = null;
		if(productId != -1) {
			product = productService.getProductById(productId);
			modelMap.put("product", product);
			modelMap.put("success", true);
		}else{
			modelMap.put("success", false);
			modelMap.put("errMsg", "empty productId");
		}
		return modelMap;
	}
}

1.2验证

2.前端

2.1 html

2.2js

2.3验证

分类:

技术点:

相关文章:

  • 2021-12-07
  • 2021-11-13
  • 2021-11-14
  • 2021-11-13
猜你喜欢
  • 2021-12-26
  • 2021-12-26
  • 2021-12-26
  • 2021-11-23
  • 2021-11-13
  • 2022-01-03
  • 2021-11-13
相关资源
相似解决方案