摘要: <form:form action="${pageContext.request.contextPath}/emp" method="POST" modelAttribute="employee"> <br> <c:if test="${employee.id == null }"> <!-- pa 阅读全文
posted @ 2018-02-27 17:18 逆水乘舟,不进则退 阅读(1540) 评论(0) 推荐(0) 编辑
摘要: 1、重定向 <mvc:view-controller path="/" view-name="redirect:/admin/index"/> 即如果当前路径是/ 则重定向到/admin/index 2、view name <mvc:view-controller path="/" view-nam 阅读全文
posted @ 2018-02-19 15:08 逆水乘舟,不进则退 阅读(1280) 评论(0) 推荐(0) 编辑
摘要: 1.在dispatcherServlet-servlet.xml配置自定义视图 <!-- 配置视图 BeanNameViewResolver 解析器: 使用视图的名字来解析视图 --> <!-- 通过 order 属性来定义视图解析器的优先级, order 值越小优先级越高 --> <bean cl 阅读全文
posted @ 2018-02-18 20:19 逆水乘舟,不进则退 阅读(231) 评论(0) 推荐(0) 编辑
摘要: /** * 1. 有 @ModelAttribute 标记的方法, 会在每个目标方法执行之前被 SpringMVC 调用! * 2. @ModelAttribute 注解也可以来修饰目标方法 POJO 类型的入参, 其 value 属性值有如下的作用: * 1). SpringMVC 会使用 val 阅读全文
posted @ 2018-02-17 21:06 逆水乘舟,不进则退 阅读(616) 评论(0) 推荐(0) 编辑
摘要: /** * 目标方法的返回值可以是 ModelAndView 类型。 * 其中可以包含视图和模型信息 * SpringMVC 会把 ModelAndView 的 model 中数据放入到 request 域对象中. * @return */ @RequestMapping("/testModelAn 阅读全文
posted @ 2018-02-10 15:44 逆水乘舟,不进则退 阅读(171) 评论(0) 推荐(0) 编辑
摘要: /** * 可以使用 Serlvet 原生的 API 作为目标方法的参数 具体支持以下类型 * * HttpServletRequest * HttpServletResponse * HttpSession * java.security.Principal * Locale InputStrea 阅读全文
posted @ 2018-02-10 15:20 逆水乘舟,不进则退 阅读(138) 评论(0) 推荐(0) 编辑
摘要: /** * 了解: * * @CookieValue: 映射一个 Cookie 值. 属性同 @RequestParam */ @RequestMapping("/testCookieValue") public String testCookieValue(@CookieValue("JSESSI 阅读全文
posted @ 2018-02-10 14:59 逆水乘舟,不进则退 阅读(942) 评论(0) 推荐(0) 编辑
摘要: jsp页面 <a href="springmvc/testRequestParam?username=atguigu&age=11">Test RequestParam</a> /** * @RequestParam 来映射请求参数. value 值即请求参数的参数名 required 该参数是否必 阅读全文
posted @ 2018-02-10 10:42 逆水乘舟,不进则退 阅读(393) 评论(0) 推荐(0) 编辑
摘要: @PathVariable /** * @PathVariable 可以来映射 URL 中的占位符到目标方法的参数中. * @param id * @return */ jsp页面请求 <a href="springmvc/testPathVariable/1">Test PathVariable< 阅读全文
posted @ 2018-02-10 09:21 逆水乘舟,不进则退 阅读(7441) 评论(0) 推荐(0) 编辑
摘要: 今天首先SpringMvc 写了个简单的配置 1.首先搭好环境配置web.xml <!-- 配置 DispatcherServlet --> <servlet> <servlet-name>dispatcherServlet</servlet-name> <servlet-class>org.spr 阅读全文
posted @ 2018-02-08 14:58 逆水乘舟,不进则退 阅读(149) 评论(0) 推荐(0) 编辑