Loading

随笔分类 -  springmvc

摘要:今天使用springboot试了一下跳转视图,死活显示不了页面的数据给我返回视图名字,查了一下结果是加上@RestController @RestController 如果使用@RestController:所有方法都会返回数据,不会跳转页面 网上查找的原因: 如果只是使用@RestControll 阅读全文
posted @ 2020-05-22 14:04 Rzk 阅读(324) 评论(0) 推荐(0)
摘要:导入maven依赖 1 <dependencies> 2 <!--文件上传--> 3 <dependency> 4 <groupId>commons-fileupload</groupId> 5 <artifactId>commons-fileupload</artifactId> 6 <versi 阅读全文
posted @ 2020-05-02 22:55 Rzk 阅读(166) 评论(0) 推荐(0)
摘要:先配置web.xml 1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchem 阅读全文
posted @ 2020-05-01 16:33 Rzk 阅读(178) 评论(0) 推荐(0)
摘要:转发一 1 @Controller 2 public class ModelTest { 3 @RequestMapping("/t1")//url访问的地址 http://localhost:8080/springmvc_04_controller01_war_exploded/t1 4 publ 阅读全文
posted @ 2020-04-19 18:52 Rzk 阅读(416) 评论(0) 推荐(0)
摘要:1 @RequestMapping("/j3") 2 public String JsonDome3() throws JsonProcessingException { 3 ObjectMapper mapper = new ObjectMapper(); 4 Date date = new Da 阅读全文
posted @ 2020-04-12 23:48 Rzk 阅读(202) 评论(0) 推荐(0)
摘要:spring.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema 阅读全文
posted @ 2020-04-11 18:13 Rzk 阅读(511) 评论(0) 推荐(0)
摘要:1 <filter> 2 <filter-name>encoding</filter-name> 3 <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 4 <init-param> 阅读全文
posted @ 2020-04-11 14:47 Rzk
摘要:1 <form action="${pageContext.request.contextPath}/e/t1" method="post">//需要加根路径/e/t1之前加项目路径 2 <input type="text" name="name"> 3 <input type="submit"> 阅读全文
posted @ 2020-04-11 14:10 Rzk
摘要:第一种 : 通过ModelAndView 1 public class ControllerTest1 implements Controller { 2 3 public ModelAndView handleRequest(HttpServletRequest httpServletReques 阅读全文
posted @ 2020-04-11 11:58 Rzk 阅读(494) 评论(0) 推荐(0)
摘要:@Controller public class RestFullController { //映射访问路径 @RequestMapping("/r1") public String RestFull(int a,int b,Model model){ //Spring MVC会自动实例化一个Mod 阅读全文
posted @ 2020-04-10 23:50 Rzk 阅读(224) 评论(0) 推荐(0)
摘要://声明Spring类的实例是一个控制器 @Controller //@RequestMapper注解用于映射url到控制器或一个特定的处理程序方法,可用于类和方法@RequestMapping 1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app 阅读全文
posted @ 2020-04-10 13:52 Rzk
摘要:1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 阅读全文
posted @ 2020-04-10 13:33 Rzk
摘要:1 <?xml version="1.0" encoding="UTF-8"?> 2 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 阅读全文
posted @ 2020-04-10 12:46 Rzk