Java日记2018-07-31-高并发web

1 遇到问题 The origin server did not find a current representation for the target resource
最后发现url写错,这是个奇葩的问题,应该是http://localhost:8080/seckill/seckill/list
controller在写映射的时候多了个seckill,忘了第一个seckill是项目名

@Component
@RequestMapping("/seckill")//url:模块/资源/{}/细分
public class SeckillController
{
    @Autowired
    private SeckillService seckillService;

    @RequestMapping(value = "/list",method = RequestMethod.GET)
    public String list(Model model)
    {
        //list.jsp+mode=ModelAndView
        //获取列表页
        List list=seckillService.getSeckillList();
        System.out.println(list);
        model.addAttribute("list",list);
        return "list";
    }
image.png

最后查看详情的时候也是报错,还是一样的问题,使用url http://localhost:8080/seckill/seckill/1000/detail解决问题
觉得删除class上的RequestMapping比较好

你可能感兴趣的:(Java日记2018-07-31-高并发web)