摘要: 测试 阅读全文
posted @ 2021-01-21 15:23 why666 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 1.写controller层 package com.why.controller; import com.why.bean.Books; import com.why.service.Service; import org.springframework.beans.factory.annotat 阅读全文
posted @ 2020-09-03 14:24 why666 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 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-in 阅读全文
posted @ 2020-09-03 14:18 why666 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 1.配置spring-service.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/ 阅读全文
posted @ 2020-09-03 13:48 why666 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 1.配置pom.xml配置文件 <dependencies> <!--Junit--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> 阅读全文
posted @ 2020-09-03 13:30 why666 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 1.概念 过滤器 servlet规范中的一部分,任何java web工程都可以使用 在url-pattern中配置了/*之后,可以对所有要访问的资源进行拦截 拦截器 拦截器是SpringMVC框架自己的,只有使用了SpringMVC框架的工程才能使用 拦截器只会拦截访问的控制器方法, 如果访问的是j 阅读全文
posted @ 2020-09-02 20:53 why666 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 1.使用过滤器 (之前做web项目弄过,直接贴代码 package com.why; import javax.servlet.*; import java.io.IOException; /** * @program: Spring_MVC * @description: * @author: @ 阅读全文
posted @ 2020-09-02 14:51 why666 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 1.参数一致 http://localhost:8080/MVC_04/?name=why 此时,访问的方法参数里面也写一个String name ,此时就会自动匹配对应的参数 如下,此时控制台打印处why @GetMapping("/s") public void showData(String 阅读全文
posted @ 2020-09-02 14:45 why666 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 1.直接上代码 package com.why.Controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework. 阅读全文
posted @ 2020-09-02 14:27 why666 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 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-ins 阅读全文
posted @ 2020-09-02 13:06 why666 阅读(138) 评论(0) 推荐(0) 编辑