springmvc模块化管理
统一了编码规范,便于代码管理整合书写,便于后期维护,统一url目录
@Controller
@RequestMapping("/user")
public class UserController {
@RequestMapping("/hello")
public String sayhello(){
System.out.println("sayhello?");
return "success";
}
}
<html>
<head>
<title>Title</title>
</head>
<body>
${pageContext.request.contextPath}
<a href="${pageContext.request.contextPath}/user/hello">(跳转)</a>
</body>
</html>
${pageContext.request.contextPath}
上面代表取项目跟路径开始找jsp文件