@Controller
@RequestMapping("/demo")
public class HelloController {
@RequestMapping("/hello.do")
public ModelAndView handleRequest(HttpServletRequest arg0,
HttpServletResponse arg1) throws Exception {
System.out.println("Hello, Controller.");
return new ModelAndView("jsp/hello");
}
}
@Controller
@RequestMapping("/demo/hello.do")
public class HelloController {
public ModelAndView handleRequest(HttpServletRequest arg0,
HttpServletResponse arg1) throws Exception {
System.out.println("Hello, Controller.");
return new ModelAndView("jsp/hello");
}
}
有区别吗?为什么第二种写法会报错?