SpringMVC01:入门、请求参数绑定、自定义类型转换器、常见注解




- 易于整合其他框架
- 无须实现任何接口
- 支持RESTful 编程风格

- 清晰的角色划分



<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<!--任何请求都会经过servlet-->
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h3>入门程序</h3>
<a href="hello">入门程序</a>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!--开启注解的扫描,需要有context支持注解-->
<context:component-scan base-package="cn.itcast"></context:component-scan>
<!--配置视图解析器对象,访问WEB-INF下的文件-->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--配置访问路径的前缀和后缀-->
<property name="prefix" value="/WEB-INF/pages"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<!--开启SpringMVC框架注解的支持-->
<mvc:annotation-driven/>
</beans>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocationn</param-name>
<param-value>classpath:springmvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<!--任何请求都会经过servlet-->
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
package cn.itcast.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 控制器类
*/
@Controller
public class HelloController {
@RequestMapping(path="hello")
public String sayHello(){
System.out.println("hello SpringMVC");
return "success";
}
}
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h3>入门成功</h3>
</body>
</html>





- path和value相同,value可以省略
- method[]表示可以请求的方式,GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE
- 用于指定限制请求参数的条件。它支持简单的表达式。要求请求参数的 key 和 value 必须和配置的一模一样。= 和 !分别表示等于或不等于
- headers:用于指定限制请求消息头的条件。
package cn.itcast.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* 控制器类
* /user/hello:放在类上或方法上代表一级/二级目录
*/
@Controller
@RequestMapping(path = "/user")
public class HelloController {
@RequestMapping(path="/hello")
public String sayHello(){
System.out.println("hello SpringMVC");
return "success";
}
/**
* 测试RequestMapping注解
* @return
*/
@RequestMapping(path = "/testRequestMapping",method = {RequestMethod.GET,RequestMethod.POST}
,params = {"username=heihei"},headers = {"Accept"})
public String testRequestMapping(){
System.out.println("测试RequestMapping...");
return "success";
}
}
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h3>入门程序</h3>
<%--<a href="hello">入门程序</a>--%>
<a href="/user/testRequestMapping?username=heihei">RequestMapping注解</a>
</body>
</html>


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--请求参数的绑定(写相对路径)
请求参数多时,可以使用JavaBean进行封装
--%>
<a href="param/testParam?username=liujinhui&password=qaz123">请求参数绑定</a>
</body>
</html>
package cn.itcast.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 请求参数的绑定
*/
@Controller
@RequestMapping("/param")
public class ParamController {
/**
* 请求参数绑定的入门
* @return
*/
@RequestMapping("/testParam")
public String testParam(String username,String password){
System.out.println("执行了..."+username+password);
return "success";
}
}
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--请求参数的绑定(写相对路径)
请求参数多时,可以使用JavaBean进行封装
--%>
<%--<a href="param/testParam?username=liujinhui&password=qaz123">请求参数绑定</a>--%>
<form action="/param/saveAccount" method="post">
姓名:<input type="text" name="username" /><br>
密码:<input type="text" name="password" /><br>
金额:<input type="text" name="money" /><br>
用户姓名:<input type="text" name="user.uname" /><br>
用户年龄:<input type="text" name="user.age" /><br>
<input type="submit" value="提交now" /><br>
</form>
</body>
</html>
package cn.itcast.controller;
import cn.itcast.domain.Account;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 请求参数的绑定
*/
@Controller
@RequestMapping("/param")
public class ParamController {
/**
* 请求参数绑定的入门
* @return
*/
@RequestMapping("/testParam")
public String testParam(String username,String password){
System.out.println("执行了..."+username+password);
return "success";
}
/**
* 把请求参数绑定,将数据封装到Java Bean的类中
* @param username
* @param password
* @return
*/
@RequestMapping("/saveAccount")
public String saveAccount(Account account){
System.out.println(account);
return "success";
}
}
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<!--配置前端控制器-->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc.xml</param-value>
</init-param>
<!--启动服务器时servlet就会创建dispatcherServlet对象-->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<!--任何请求都会经过servlet-->
<url-pattern>/</url-pattern>
</servlet-mapping>
<!--配置解决中文乱码的过滤器-->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--把数据封装到Account类中,类中存在List和Map的集合--%>
<form action="/param/saveAccount" method="post">
姓名:<input type="text" name="username" /><br>
密码:<input type="text" name="password" /><br>
金额:<input type="text" name="money" /><br>
用户姓名:<input type="text" name="list[0].uname" /><br>
用户年龄:<input type="text" name="list[0].age" /><br>
用户姓名:<input type="text" name="map['one'].uname" /><br>
用户年龄:<input type="text" name="map['one'].age" /><br>
<input type="submit" value="提交now" /><br>
</form>
</body>
</html>
public class Account implements Serializable {
private String username;
private String password;
private Double money;
private List<User> list;
private Map<String,User> map;
public List<User> getList() {
return list;
}
public void setList(List<User> list) {
this.list = list;
}
public Map<String, User> getMap() {
return map;
}
public void setMap(Map<String, User> map) {
this.map = map;
}
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--自定义类型转换器--%>
<form action="/param/saveUser" method="post">
用户姓名:<input type="text" name="uname" /><br>
用户年龄:<input type="text" name="age" /><br>
用户生日:<input type="text" name="date" /><br>
<input type="submit" value="提交now" /><br>
</form>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!--开启注解的扫描,需要有context支持注解-->
<context:component-scan base-package="cn.itcast"></context:component-scan>
<!--配置视图解析器对象,访问WEB-INF下的文件-->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--配置访问路径的前缀和后缀-->
<property name="prefix" value="/WEB-INF/pages/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<!--配置自定义类型转换器-->
<bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
<property name="converters">
<set>
<bean class="cn.itcast.utils.StringToDataConverter"/>
</set>
</property>
</bean>
<!--开启SpringMVC框架注解的支持-->
<mvc:annotation-driven conversion-service="conversionService"/>
</beans>
package cn.itcast.utils;
import org.springframework.core.convert.converter.Converter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 把字符串转换成日期
*/
public class StringToDataConverter implements Converter<String, Date> {
/**
*
* @param source 传入进来的字符串的值
* @return
*/
@Override
public Date convert(String source) {
//判断
if (source == null){
throw new RuntimeException("请您传入数据");
}
try {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//把字符串转换为日期
return df.parse(source);
} catch (Exception e) {
throw new RuntimeException("数据类型转换出现错误");
}
}
}
package cn.itcast.controller;
import cn.itcast.domain.Account;
import cn.itcast.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* 请求参数的绑定
*/
@Controller
@RequestMapping("/param")
public class ParamController {
/**
* 原生的api
* @return
*/
@RequestMapping("/testServlet")
public String testServlet(HttpServletRequest request, HttpServletResponse response){
System.out.println(request);
HttpSession session = request.getSession();
System.out.println(session);
ServletContext servletContext = session.getServletContext();
System.out.println(servletContext);
System.out.println(response);
return "success";
}
}
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--常用的注解--%>
<a href="anno/testRequestParam?name=哈哈">RequestParam</a>
</body>
</html>
package cn.itcast.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 常用的注解
*/
@Controller
@RequestMapping("/anno")
public class AnnoController {
@RequestMapping("/testRequestParam")
//表示不一定required(默认)
public String testRequestParam(@RequestParam(name="name",required=false) String username){
System.out.println("testRequestParam执行了");
System.out.println(username);
return "success";
}
}

package cn.itcast.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 常用的注解
*/
@Controller
@RequestMapping("/anno")
public class AnnoController {
/**
* 获取到请求体的内容
* @param username
* @return
*/
@RequestMapping("/testRequestBody")
public String testRequestBody(@RequestBody String body){
System.out.println("testRequestParam执行了");
System.out.println(body);
return "success";
}
}
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<form action="/anno/testRequestBody" method="post">
用户姓名:<input type="text" name="username" /><br>
用户年龄:<input type="text" name="age" /><br>
<input type="submit" value="提交now" /><br>
</form>
</body>
</html>


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--常用的注解--%>
<a href="anno/testPathVariable/10">RequestParam</a>
</body>
</html>
package cn.itcast.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 常用的注解
*/
@Controller
@RequestMapping("/anno")
public class AnnoController {
/**
* PathVariable注解
* @return
*/
@RequestMapping("/testPathVariable/{sid}")
public String testPathVariable(@PathVariable(name="sid") String id){
System.out.println("testPathVariable执行了");
System.out.println(id);
return "success";
}
}


<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--常用的注解--%>
<a href="anno/testRequestHeader">RequestParam</a>
</body>
</html>
/**
* 获取请求头的值
* @param header
* @return
*/
@RequestMapping(value = "/testRequestHeader")
public String testRequestHeader(@RequestHeader(value="Accept") String header){
System.out.println("testPathVariable执行了");
System.out.println(header);
return "success";
}

@RequestMapping(value = "/testCookieValue")
public String testCookieValue(@CookieValue(value = "JSESSIONID") String cookieValue){
System.out.println("testPathVariable执行了");
System.out.println(cookieValue);
return "success";
}

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--常用的注解--%>
<a href="anno/testCookieValue">RequestParam</a>
<form action="/anno/testModelAttribute" method="post">
用户姓名:<input type="text" name="uname" /><br>
用户年龄:<input type="text" name="age" /><br>
<input type="submit" value="提交now" /><br>
</form>
</body>
</html>
/**
* ModelAttribute注解
* @return
*/
@RequestMapping(value = "/testModelAttribute")
public String testModelAttribute(User user){//直接拿到
//此时就能拿到User的日期
System.out.println("testModelAttribute执行了");
System.out.println(user);
return "success";
}
/**
* 有返回值
* 该方法会先执行
* 操作:
*/
@ModelAttribute
public User showUser(String uname){
System.out.println("showUser方法执行了");
//通过用户名查询数据库(模拟)
User user = new User();
user.setUname(uname);
user.setAge(20);
user.setDate(new Date());
//将全部数据封装上
return user;
}
/**
* ModelAttribute注解
* @return
*/
@RequestMapping(value = "/testModelAttribute")
//方法内需要借助ModelAttribute注解
public String testModelAttribute(@ModelAttribute(value="abc") User user){
//此时就能拿到User的日期
System.out.println("testModelAttribute执行了");
System.out.println(user);
return "success";
}
/**
* 没有返回值
* @param uname
* @return
*/
@ModelAttribute
public void showUser(String uname, Map<String,User> map){
System.out.println("showUser方法执行了");
//通过用户名查询数据库(模拟)
User user = new User();
user.setUname(uname);
user.setAge(20);
user.setDate(new Date());
map.put("abc",user);
//将全部数据封装上
}

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<%--常用的注解--%>
<a href="anno/testCookieValue">RequestParam</a>
<form action="/anno/testModelAttribute" method="post">
用户姓名:<input type="text" name="uname" /><br>
用户年龄:<input type="text" name="age" /><br>
<input type="submit" value="提交now" /><br>
</form>
<br>
<a href="anno/testSessionAttributes">RequestParam</a><br>
<a href="anno/getSessionAttributes">从session域中取值</a><br>
<a href="anno/delSessionAttributes">删除</a>
</body>
</html>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h3>入门成功</h3>
${ msg }
${ requestScope.msg }
${ sessionScope }
</body>
</html>
package cn.itcast.controller;
import cn.itcast.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.support.SessionStatus;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.Map;
/**
* 常用的注解
*/
@Controller
@RequestMapping("/anno")
@SessionAttributes(value={"msg"}) //相当于把msg=美美存入到session域中
public class AnnoController {
/**
* SessionAttributes的注解
* @return
*/
@RequestMapping(value = "/testSessionAttributes")
public String testSessionAttributes(Model model){
//HttpServletRequest request作为参数
//此时就能拿到User的日期
System.out.println("testModelAttribute执行了");
//希望向request存一个值,从成功页面中把值取出来
//request.setAttribute("aaa","123");耦合性过高
//底层会存储到request对象中
model.addAttribute("msg","美美");
return "success";
}
/**
* 从session域中取值
* @param modelMap
* @return
*/
@RequestMapping(value = "/getSessionAttributes")
public String getSessionAttributes(ModelMap modelMap){
String msg = (String) modelMap.get("msg");
System.out.println(msg);
return "success";
}
/**
* 清除
* @param status
* @return
*/
@RequestMapping(value = "/delSessionAttributes")
public String delSessionAttributes(SessionStatus status){
status.setComplete();//清除
return "success";
}
}
SpringMVC01:入门、请求参数绑定、自定义类型转换器、常见注解的更多相关文章
- Spring MVC请求参数绑定 自定义类型转化 和获取原声带额servlet request response信息
首先还在我们的框架的基础上建立文件 在domian下建立Account实体类 import org.springframework.stereotype.Controller; import org. ...
- springmvc:请求参数绑定集合类型
一.请求参数绑定实体类 domain: private String username; private String password; private Double money; private ...
- 阶段3 3.SpringMVC·_02.参数绑定及自定义类型转换_2 请求参数绑定实体类型
参数封装到javaBean对象中 创建新的包domain.在下面新建Account 实现序列化 的接口,定义几个属性 生成get和set.还有toString的方法 表单 重新发布tomcat jav ...
- 阶段3 3.SpringMVC·_02.参数绑定及自定义类型转换_4 请求参数绑定集合类型
jabaBean里面有集合的情况 把account里面的user对象先注释掉.get和set都注释掉.然后toString方法需要重写 List和Map这两种对象.生成get和set方法 toStri ...
- 阶段3 3.SpringMVC·_02.参数绑定及自定义类型转换_6 自定义类型转换器代码编写
mvc是基于组件的方式 类型转换的接口Converter,想实现类型转换,必须实现这个接口 Ctrl+N搜索 converter 这是一个接口类 它有很多的实现类.S是字符串.后面T是指要转换类型 新 ...
- 《SpringMVC从入门到放肆》十二、SpringMVC自定义类型转换器
之前的教程,我们都已经学会了如何使用Spring MVC来进行开发,掌握了基本的开发方法,返回不同类型的结果也有了一定的了解,包括返回ModelAndView.返回List.Map等等,这里就包含了传 ...
- 自定义类型转换器 及 使用 ServletAPI 对象作为方法参数
自定义类型转换器使用场景: jsp 代码: <!-- 特殊情况之:类型转换问题 --> <a href="account/deleteAccount?date=2018- ...
- <SpringMvc>入门三 参数绑定
1.get请求 <%--请求参数的绑定--%> <%--get请求参数--%> <a href="/param/testParam1?username=tom& ...
- SpringMVC 请求参数绑定
什么是请求参数绑定 请求参数格式 默认是key/value格式,比如:http:xxxx?id=1&type=2 请求参数值的数据类型 都是字符串类型的各种值 请求参数值要绑定的目标类型 Co ...
- [原创]java WEB学习笔记67:Struts2 学习之路-- 类型转换概述, 类型转换错误修改,如何自定义类型转换器
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...
随机推荐
- Elasticsearch的ETL利器——Ingest节点
文章转载自: https://mp.weixin.qq.com/s?__biz=MzI2NDY1MTA3OQ==&mid=2247484473&idx=1&sn=1b3b07b ...
- Elasticsearch基础但非常有用的功能之一:别名
文章转载自: https://mp.weixin.qq.com/s?__biz=MzI2NDY1MTA3OQ==&mid=2247484454&idx=1&sn=43e95a2 ...
- Beats & FileBeat
Beats是一个开放源代码的数据发送器.我们可以把Beats作为一种代理安装在我们的服务器上,这样就可以比较方便地将数据发送到Elasticsearch或者Logstash中.Elastic Stac ...
- 1-Mysql数据库简洁命令
1-进入mysql数据库 mysql -u root -p 2-创建数据库 mysql> CREATE DATABASE serurities_master; mysql> USE ser ...
- NSIS安装界面无虚线框移动
最近很多应用程序都在安装界面的美化上面下足了功夫,一个漂亮流畅的安装界面无疑会给其带来用户体验上的加分,其中一个无虚线框跟随鼠标移动比较有趣,狂翻msdn后终于找到了控制函数SystemParamet ...
- 聊聊SQL注入
SQL注入问题 概述: 首先SQL注入是一个非常危险的操作,很可能被一些不怀好意的人钻空导致我们系统出现异常等状况,比如数据库遭到破坏或被入侵. 原因:使用JDBC的Statement语句添加SQL语 ...
- 从SpringBoot启动,阅读源码设计
目录 一.背景说明 二.SpringBoot工程 三.应用上下文 四.资源加载 五.应用环境 六.Bean对象 七.Tomcat服务 八.事件模型 九.配置加载 十.数据库集成 十一.参考源码 服务启 ...
- 代码随想录第七天| 454.四数相加II、383. 赎金信 、15. 三数之和 、18. 四数之和
第一题454.四数相加II 给你四个整数数组 nums1.nums2.nums3 和 nums4 ,数组长度都是 n ,请你计算有多少个元组 (i, j, k, l) 能满足: 0 <= i, ...
- Vue学习之--------事件的基本使用、事件修饰符、键盘事件(2022/7/7)
文章目录 1.事件处理 1.1. 事件的基本使用 1.1.1 .基础知识 1.1.2. 代码实例 1.1.3.测试效果 1.2.事件修饰符 1.2.1. 基础知识 1.2.2 .代码实例 1.2.3 ...
- 为了讲明白继承和super、this关键字,群主发了20块钱群红包
摘要:以群主发红包为例,带你深入了解继承和super.this关键字. 本文分享自华为云社区<群主发红包带你深入了解继承和super.this关键字>,作者:共饮一杯无 . 需求 群主发随 ...