![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
springmvc
`阿杰`
这个作者很懒,什么都没留下…
展开
-
SpringMvc-文件上传和下载
index.jsp <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>$Title$</title> </head> <body> <form action="/upload2" enctype="multipart/form-data" method="post">原创 2021-03-14 17:43:59 · 88 阅读 · 0 评论 -
SpringMvc-拦截器
验证用户是否登录 1:初始页 ;可以跳转到登录页面和首页 2:首页 :只有登录之后才能进入,不然只能跳转回登录页面 3:登录页: 登录之后跳到首页 4:controller:处理请求 5:Interceptor :拦截请求,如果登录就放行 初始页 index.jsp <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>$Tit原创 2021-03-14 17:36:08 · 43 阅读 · 0 评论 -
SpringMvc-Ajax
1:初步运用 失去焦点触发事件 代码 index.jsp <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>$Title$</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>原创 2021-03-14 17:16:03 · 50 阅读 · 0 评论 -
SpringMvc-json传值
工具类 JsonUtils public class JsonUtils { public static String getJson(Object object) throws JsonProcessingException { return getJsonTime(object,"yyyy-MM-dd HH:mm:ss"); } public static String getJsonTime(Object object,String dateFormat原创 2021-03-14 16:40:43 · 111 阅读 · 0 评论 -
SpringMvc-前端传值
前端传一个普通值 和servlet一样 如何传的属性名和方法的属性名不一致用@RequestParam这个注解来解决 @GetMapping("/t1") public String t1(@RequestParam("username") String name, Model model){ System.out.println("传参为:"+name); model.addAttribute("msg",name); return "hello"原创 2021-03-14 16:23:58 · 105 阅读 · 0 评论 -
SpringMvc-RestFul风格
使用RestFul风格操作资源:可以通过不同的请求方式来实现不同的效果,如下方:请求地址一样,但功能可以不同 http://127.0.0.1/item/1 查询GET http://127.0.0.1/item/ 新增POST http://127.0.0.1/item/ 更新 PUT http://127.0.0.1/item/1 删除 DELETE 实现 使用@PathVariable标签来实现 // @RequestMapping("/rest/{a}/{b}") // get请求 //原创 2021-03-14 16:08:21 · 80 阅读 · 0 评论 -
SpringMvc-乱码问题
SpringMvc过滤器 从前端传值 然后请求跳转后成为了乱码 解决办法 在web.xml中添加下述代码(Spring容器自带的乱码过滤) <!--SpringMvc过滤器(解决乱码问题)--> <filter> <filter-name>encoding</filter-name> <filter-class>org.springframework.web.filter.CharacterEnc原创 2021-03-14 16:00:35 · 51 阅读 · 0 评论 -
SpringMvc-hello(注解)
1:配置文件 web.xml(这个配置文件一旦配置,基本不变) <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/java原创 2021-03-12 22:00:53 · 71 阅读 · 0 评论 -
SpringMvc-hello(原生)
依赖 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13</version> </dependency> <dependency> <groupId&原创 2021-03-12 21:50:33 · 77 阅读 · 0 评论