ViewResolver没有解析查看名称,而是查询RequestMapping值

时间:2015-03-26 16:33:12

标签: java spring-4

我的控制器

@RequestMapping(value = {"/Management/{code}"}, method = RequestMethod.GET)
public ModelAndView index(@PathVariable("code") String code){

    MyDAO dao = new MyDAO();
    List<Entity> list = dao.list(code);
    ModelAndView view = new ModelAndView();
    view.setViewName("myView");
    view.addObject("list", list);
    return view;
}

我的dispatcher.xml

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
          <property name="prefix" value="/WEB-INF/pages/"/>
          <property name="suffix" value=".jsp"/>
   </bean>

然后我打电话

/Management/ExampleCode

页面说我

HTTP Status 404 - /WEB-INF/pages/Management/ExampleCode.jsp

问题是我想要返回myView.jsp而不是/Management/ExampleCode.jsp

任何人都可以帮助我吗?

0 个答案:

没有答案