访问http://localhost:8080/seckill/list出现错误,不是视频中的那个:
这里说明这个路径错了,对spring mvc不太熟,不知道错哪儿了。配置如下:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> </bean>
Controller:
@Controller @RequestMapping("/seckill") public class SeckillController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private SeckillService seckillService; @RequestMapping(name = "/list", method = RequestMethod.GET) public String list(Model model) { List<Seckill> list = seckillService.getSeckillList(); model.addAttribute("list", list); return "list"; } ..... }
我的南方
_潇潇暮雨
相关分类