- 博客(12)
- 资源 (10)
- 收藏
- 关注
原创 EditText限制输入长度和特殊字符
EditText限制输入长度和特殊字符在一般的APP中都会有编辑个人信息的功能,比如编辑昵称之类的。但是EditText在输入文本信息的时候,比如输入换行或空格,那还是比较讨厌的,同时我们也不应该让用户无限制的输入,所以对输入信息的限制也是有必要的。看下面代码:MainActivitypublic class MainActivity extends AppCompatActivity { p
2017-03-29 14:03:02 3757
原创 Javaweb分页技术实现
Javaweb分页技术实现分页技术就是通过SQL语句(如下)来获取数据,具体实现看下面代码//分页查询语句select * from 表名 where limit page , count;和//获取表中的总数据,确定页数select count(*) from 表名;1.配置数据源在项目的WebContent/META-INF目录下创建一个context.xml文件。如图:在context
2017-03-24 21:33:43 21560 4
原创 Android自带的倒计时CountDownTimer
Android自带的倒计时CountDownTimerCountDownTimer类介绍:CountDownTimer类比较简单,总共就一个构造和4个方法。内部是通过handler实现。CountDownTimer(long time,long interval):参数time是总时间,interval是间隔时间。start():开始倒计时的方法。cancel():取消倒计时的方法。onTi
2017-03-21 17:23:12 1210
原创 在非Activity中请求危险权限
在非Activity中请求危险权限我们知道Android6.0之后对于危险权限需要动态申请。我们动态的请求权限,需要在activity调用requestPermissions()方法;然后在处理activity中的回调方法onRequestPermissionsResult()。那么我们怎么在非Activity动态请求权限,又如何处理activity中的回调方法呢?我的采取一个比较取巧的方法,通过创
2017-03-20 18:40:56 4455 1
原创 事务示例之转账
事务示例之转账1.创建数据库,填充数据:数据库名称db_account,表名tb_account,插入几条数据。2.配置数据库信息在项目的WebContent/META-INF目录下创建一个context.xml文件。如图: 在context.xml文件中配置:<?xml version="1.0" encoding="UTF-8"?><Context> <Resource
2017-03-18 10:13:21 968
原创 Javaweb配置常用的数据源配置
Javaweb配置常用的数据源配置一、DBCPDBCP是Apache推出的数据库连接池(Database Connection Pool)。操作步骤: - 添加jar包:[commons-dbcp-1.4.jar ](http://download.csdn.net/download/wangshuxuncom/8465507)[commons-pool-1.5.6.jar](http://dow
2017-03-10 19:15:52 5911
原创 事务的四大特性和隔离级别
事务的四大特性和隔离级别事务的四大特性原子性(Atomicity)指事务是一个不可分割的工作单位,事务中的操作要么都发生,要么都不发生。一致性事务必须使数据库从一个一致性状态变换到另外一个一致性状态。转账前和转账后的总金额不变。隔离性事务的隔离性是多个用户并发访问数据库时,数据库为每一个用户开启的事务,不能被其他事务的操作数据所干扰,多个并发事务之间要相互隔离。持久性指一个事务一旦被提交,它
2017-03-09 15:24:47 1300
原创 EL表达式和JSTL标签
EL表达式和JSTL标签EL表达式EL的概述EL(Expression Language):目的是为了是jsp写起来更加简单。EL表达式只能获取存在4个作用域中的数据。EL获取对于null这样的数据,在页面中表现为空字符串。EL语法结构:${expression}eg:<!--JSP脚本写法--><% pageContext.setAttribute("name","widsom");St
2017-03-04 23:01:50 837
原创 JSP的介绍和基本语法
JSP的介绍和基本语法jsp概述JSP全称Java Server Pages,是SUN公司定义的一种用于开发动态WEB资源的技术。它使用JSP标签在HTML网页中插入Java代码。标签通常以<%开头 %>结束。jsp适合编写输出动态内容,但不适合编写java逻辑。jsp的本质JSP本质是Servlet,jsp页面先经过翻译阶段,把jsp文件翻译成Java文件(这个Java文件其实就是Servlet)
2017-03-04 22:58:45 4537 2
原创 Session简单实现购物车功能
Session简单实现购物车功能这个小程序主要就3个页面,一个商品列表页面(HomeServlet),一个是提示加入购物车页面(AddCartTipServlet),一个是显示购物车清单页面(ShowCartServlet)。HomeServlet页面:@WebServlet({ "/HomeServlet", "/home" })public class HomeServlet extends
2017-03-01 13:22:54 12094
原创 Cookie是实现记住用户名实例
Cookie是实现记住用户名实例记住用户名的功能,登入成功后,给响应消息头添加用户名的Cookie信息,在登入页面时,加载cookie信息,通过cookie获取用户名信息,写在输入框中。SimpleLoginServlet(简单的登入页面):@WebServlet({ "/SimpleLoginServlet", "/simple/login" })public class SimpleLogin
2017-03-01 13:21:58 1982
原创 Cookie和Session学习
Cookie和Session学习CookieCookie简介:Cookie是一种客户端的会话技术。会话的生命周期是打开浏览器网页窗口到关闭浏览器网页窗口。cookie如果没有设置最大存活时间,在关闭浏览器网页窗口时,cookie就会消失。Cookie是通过拓展HTTP协议来实现的,服务器通过HTTP协议的响应消息头添加cookie,响应给浏览器(如果设置了cookie的最大生存时间,就会在浏览器中
2017-03-01 13:21:14 808
Gradle for Android
2016-11-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人