SpringMVC案例3----spring3.0项目拦截器、ajax、文件上传应用
依然是项目结构图和所需jar包图:
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYmVuamFtaW5fd2h4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYmVuamFtaW5fd2h4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">
显示配置文件hib-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
">
<context:component-scan base-package="com.sxt"></context:component-scan>
<!-- 支持aop注解 -->
<aop:aspectj-autoproxy></aop:aspectj-autoproxy> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/crud"></property>
<property name="username" value="root"></property>
<property name="password" value="root"></property>
</bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource"></ref>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">
true
</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="packagesToScan">
<value>com.sxt.po</value>
</property>
</bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean> <!-- 配置一个JdbcTemplate实例 -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"></property>
</bean> <!-- 配置事务管理 -->
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean> <tx:annotation-driven transaction-manager="txManager"/>
<aop:config>
<aop:pointcut expression="execution(public * com.sxt.service.impl.*.*(..))" id="businessService"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="businessService"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="find*" read-only="true" propagation="NOT_SUPPORTED"/>
<!-- get开头的方法不须要在事务中执行。有些情况是没有必要使用事务的。比方获取数据。开启事务本身对性能本身是有一定的影响的 -->
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
</beans>
再是springmvc-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<!-- 対web包中的全部的类进行扫描,以完毕bean的创建和自己主动依赖输入功能 -->
<context:component-scan base-package="com.sxt"></context:component-scan>
<!-- 启动springmvc的注解功能,完毕请求和注解POJO的映射 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="cacheSeconds" value="0"></property>
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
</bean>
</list>
</property>
</bean>
<!-- 对模型视图名称的解析,即在模型视图名称加入前后缀 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<property name="suffix" value=".jsp"></property>
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
</bean>
<!-- 处理文件上传 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 默认编码 -->
<property name="defaultEncoding" value="utf-8"></property>
<property name="maxInMemorySize" value="10240"/><!-- 最大内存大小 -->
<!-- 上传后的文件夹名 -->
<property name="uploadTempDir" value="/upload/"></property>
<!-- 最大文件大小,-1为无限制 -->
<property name="maxUploadSize" value="-1"></property> </bean>
<mvc:interceptors>
<!-- 拦截全部springmvc的url -->
<bean class="com.sxt.interceptor.MyInterceptor"></bean>
<mvc:interceptor>
<mvc:mapping path="/user.do"/>
<bean class="com.sxt.interceptor.MyInterceptor2"></bean>
</mvc:interceptor>
</mvc:interceptors>
</beans>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/hib-config.xml,/WEB-INF/springmvc-servlet.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
dao层的userDao
package com.sxt.dao; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository; import com.sxt.po.User;
@Repository("userDao")
public class UserDao {
@Autowired
private HibernateTemplate hibernateTemplate ; public void add(User u){
System.out.println("userDao.add()");
hibernateTemplate.save(u) ;
} }
模型层的user类
package com.sxt.po; import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; @Entity
public class User {
private int id ;
private String name ;
private String pwd ;
public User(){}
public User(String name,String pwd){
this.name = name ;
this.pwd = pwd ;
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
} }
service层的userService类
package com.sxt.service; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import com.sxt.dao.UserDao;
import com.sxt.po.User;
@Service("userService")
public class UserService {
@Autowired
private UserDao userDao ;
public void add(String name){
System.out.println("UserService.add()");
User u = new User() ;
u.setName(name) ;
userDao.add(u) ;
} }
controller层的userController类
package com.sxt.action; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes; import com.sxt.service.UserService;
@org.springframework.stereotype.Controller("userController")
@RequestMapping("/user.do")
@SessionAttributes({"uname"})
public class UserController{
@Autowired
private UserService userService ;
@RequestMapping(params="method=reg")
public String reg(String uname){
System.out.println("UserController.reg()");
userService.add(uname) ;
return "index" ;
}
@RequestMapping(params="method=reg2")
public String reg2(@RequestParam("uname")String name,ModelMap map){
System.out.println("UserController.reg2()");
userService.add(name) ;
map.put("b", "bbb") ;
return "index" ;
}
@RequestMapping(params="method=reg3")
public String reg3(String uname,ModelMap map){
System.out.println("UserController.reg3()");
userService.add(uname) ;
System.out.println(uname);
map.put("uname", uname) ;
return "index" ;
}
@RequestMapping(params="method=reg4")
public String reg4(String uname,ModelMap map){
System.out.println("UserController.reg4()");
// return "forward:user.do? method=reg3" ; //转发,不写默认就是转发
return "redirect:http://www.baidu.com" ;//重定向
}
@RequestMapping(params="method=reg5")
public String reg5(String uname){
System.out.println("UserController.reg4()");
return "redirect:http://www.baidu.com" ;//重定向
} }
MyAjaxController类
package com.sxt.action; import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import com.sxt.po.User;
@Controller
@RequestMapping("myajax.do")
public class MyAjaxController {
@RequestMapping(params="method=test2",method=RequestMethod.GET)
public @ResponseBody List<User> test1(String uname) throws Exception{
String uname2 = new String(uname.getBytes("iso8859-1"),"utf-8") ;
System.out.println(uname2);
System.out.println("MyAjaxController.test1()");
List<User> list = new ArrayList<User>() ;
list.add(new User("吴海旭","123")) ;
list.add(new User("韩敬琼","456")) ;
System.out.println(list.size());
return list ;
}
}
FileUoLoadController类
package com.sxt.action; import java.io.File;
import java.util.Date; import javax.servlet.ServletContext; import org.apache.log4j.chainsaw.Main;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.context.ServletContextAware;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
@Controller("fileUpLoadController")
public class FileUpLoadController implements ServletContextAware{
private ServletContext servletContext ;
@Override
public void setServletContext(ServletContext servletContext) {
// TODO Auto-generated method stub
this.servletContext = servletContext ;
}
@RequestMapping(value="/upload.do",method=RequestMethod.POST)
public String handleUploadData(String name,@RequestParam("file")CommonsMultipartFile file){
if(!file.isEmpty()){
//获取本地存储路径,必须在项目下建立一个这种路径
String path = this.servletContext.getRealPath("/upload/") ;
System.out.println(path);
//获取文件名
String fileName = file.getOriginalFilename() ;
//获取文件后缀名
String fileType = fileName.substring(fileName.lastIndexOf(".")) ;
System.out.println(fileType);
File file2 = new File(path,new Date().getTime()+fileType) ;
try {
file.getFileItem().write(file2) ;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "redirect:upload_ok.jsp" ;
}else{
return "redirect:upload_error.jsp" ;
}
}
}
拦截器层的MyInterceptor类
package com.sxt.interceptor; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView; public class MyInterceptor implements HandlerInterceptor{ @Override
public void afterCompletion(HttpServletRequest arg0,
HttpServletResponse arg1, Object arg2, Exception arg3)
throws Exception {
// TODO Auto-generated method stub
System.out.println("最后运行,一般用于释放资源!!!");
} @Override
public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1,
Object arg2, ModelAndView arg3) throws Exception {
// TODO Auto-generated method stub
System.out.println("action运行之后,生成视图之前!。");
} @Override
public boolean preHandle(HttpServletRequest arg0, HttpServletResponse arg1,
Object arg2) throws Exception {
// TODO Auto-generated method stub
System.out.println("action之前运行");
return true;
} }
MyInterceptor2类
package com.sxt.interceptor; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; public class MyInterceptor2 extends HandlerInterceptorAdapter{
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
// TODO Auto-generated method stub
System.out.println("MyInterceptor2.preHandle()");
return true;
}
}
用于測试ajax的a.jsp文件
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'a.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script>
function createAjaxObj(){
var req ;
if(window.XMLHttpRequest){
req = new XMLHttpRequest() ;
}else{
req = new ActiveXObject("Msxml2.XMLHTTP") ;
}
return req ;
}
function sendAjaxReq(){
var req = createAjaxObj() ;
req.open("get","myajax.do?method=test2&uname=张三") ;
req.setRequestHeader("accept","application/json") ;
req.onreadystatechange = function(){
var msg = req.responseText ;
eval("var result=" + msg) ;
document.getElementById("div1").innerHTML = result[0].name ;
}
req.send(null) ;
}
</script>
</head> <body>
<a href="javascript:void(0);" onclick="sendAjaxReq();">測试</a>
<div id="div1"></div>
</body>
</html>
index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head> <body>
${requestScope.uname} <br />
${sessionScope.uname} <br />
</body>
</html>
index2.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'index2.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<form action="user.do">
姓名:<input type="text" name="uname"/><br />
<input type="hidden" name="method" value="reg3">
<input type="submit" value="注冊 " />
</form>
</body>
</html>
upload_error.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'upload_error.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<h1>上传失败!</h1>
</body>
</html>
upload_ok.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'upload_ok.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<h1>上传成功! </h1>
</body>
</html>
upload.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>測试springmvc中的上传的实现</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<form action="upload.do" method="post" enctype="multipart/form-data">
<input type="text" name="name" />
<input type="file" name="file" />
<input type="submit" />
</form>
</body>
</html>
至此整个springmvc重要的东西測试完成!
SpringMVC案例3----spring3.0项目拦截器、ajax、文件上传应用的更多相关文章
- 深入分析JavaWeb Item47 -- Struts2拦截器与文件上传下载
一.struts2中的拦截器(框架功能核心) 1.过滤器VS拦截器 过滤器VS拦截器功能是一回事. 过滤器是Servlet规范中的技术,能够对请求和响应进行过滤. 拦截器是Struts2框架中的技术. ...
- Struts2学习第四天——拦截器及文件上传
1.概述 Struts2的很多核心功能都是由拦截器完成的. 拦截器很好的实现了AOP的编程思想,在动作的执行之前和结果的返回之后,做拦截处理. 2.struts2的默认拦截器栈 3.自定义拦截器 St ...
- 利用Struts2拦截器完成文件上传功能
Struts2的图片上传以及页面展示图片 在上次的CRUD基础上加上图片上传功能 (https://www.cnblogs.com/liuwenwu9527/p/11108611.html) 文件上传 ...
- Spring MVC—拦截器,文件上传,中文乱码处理,Rest风格,异常处理机制
拦截器 文件上传 -中文乱码解决 rest风格 异常处理机制 拦截器 Spring MVC可以使用拦截器对请求进行拦截处理,用户可以自定义拦截器来实现特定的功能,自定义的拦截器必须实现HandlerI ...
- springMVC学习记录3-拦截器和文件上传
拦截器和文件上传算是springmvc中比较高级一点的内容了吧,让我们一起看一下. 下面先说说拦截器.拦截器和过滤器有点像,都可以在请求被处理之前和请求被处理之到做一些额外的操作. 1. 实现Hand ...
- node.js 在 Express4.0 框架使用 Connect-Busboy 实现文件上传
node.js下四种post提交数据的方式 今天说分享的是其中一种,就是上传文件. Express 4.0 以后,将功能原子化,高内聚,低耦合,独立出了很多中间件 今天主要分享文件上传 对于conne ...
- springmvc+ajax文件上传
环境:JDK6以上,这里我是用JDK8,mysql57,maven项目 框架环境:spring+springmvc+mybaits或spring+springmvc+mybatis plus 前端代码 ...
- 学习SpringMVC必知必会(7)~springmvc的数据校验、表单标签、文件上传和下载
输入校验是 Web 开发任务之一,在 SpringMVC 中有两种方式可以实现,分别是使用 Spring 自带的验证 框架和使用 JSR 303 实现, 也称之为 spring-validator 和 ...
- SpringMVC+ajax文件上传实例教程
原文地址:https://blog.csdn.net/weixin_41092717/article/details/81080152 文件上传文件上传是项目开发中最常见的功能.为了能上传文件,必须将 ...
随机推荐
- Label,PushButton,ToolButton 实现动态图片按钮,Label显示gif动画
.h文件 public: explicit event(QWidget *parent = 0); ~event(); QImage image; QLabel *label; QLabel *lab ...
- Django REST Framework - 分页 - 渲染器 - 解析器
为什么要使用分页? 我们数据表中可能会有成千上万条数据,当我们访问某张表的所有数据时,我们不太可能需要一次把所有的数据都展示出来,因为数据量很大,对服务端的内存压力比较大还有就是网络传输过程中耗时也会 ...
- ./configure --prefix /?/? 解释
-- ./configure :编译源码 --prefix :把所有资源文件放在 之后的路径之后
- POJ 3904
第一道莫比乌斯反演的题. 建议参看http://www.isnowfy.com/mobius-inversion/ 摘其中部分 证明的话感觉写起来会比较诡异,大家意会吧说一下这个经典题目:令R(M,N ...
- 在 RedHat/CentOS 7.x 中使用 nmcli 命令管理网络
在 RedHat/CentOS 7.x 中使用 nmcli 命令管理网络 学习了:https://linux.cn/article-5410-1.html#3_3613 http://www.linu ...
- netty底层是事件驱动的异步库 但是可以await或者sync(本质是future超时机制)同步返回 但是官方 Prefer addListener(GenericFutureListener) to await()
io.netty.channel 摘自:https://netty.io/4.0/api/io/netty/channel/ChannelFuture.html Interface ChannelFu ...
- javascript系列-class10.DOM(下)
1.node节点(更详细的获取(设置)页面中所有的内容) 根据 W3C 的 HTML DOM 标准,HTML 文档中的所有内容都是节点: 元素是节点的别称,节点包含元素当然节点还有 ...
- (转载) 使用DrawerLayout和NavigationView从右侧出现
使用DrawerLayout和NavigationView从右侧出现 2016-07-21 17:53 957人阅读 评论(0) 收藏 举报 分类: android(9) 版权声明:本文为博主原创 ...
- django steps EASY WAY
django 2.0 python 3.6 =========django steps EASY WAY=========== reference: https://djangoforbeginner ...
- HDU 1950 Bridging signals【最长上升序列】
解题思路:题目给出的描述就是一种求最长上升子序列的方法 将该列数an与其按升序排好序后的an'求出最长公共子序列就是最长上升子序列 但是这道题用这种方法是会超时的,用滚动数组优化也超时, 下面是网上找 ...