摘要: 读取文件转为字符串: //输入文件File类型,输出字符串 public static String fileToString(File file) { InputStream is = null; ByteArrayOutputStream bos = new ByteArrayOutputStr 阅读全文
posted @ 2024-02-19 20:09 小宁同学柠檬茶 阅读(71) 评论(0) 推荐(0) 编辑
摘要: String[] arr={"qwe","asd","zxc","asddf","hghgf"}; List<String> s=Arrays.asList(srr); 亲测有效! 阅读全文
posted @ 2018-12-27 16:12 小宁同学柠檬茶 阅读(1061) 评论(0) 推荐(0) 编辑
摘要: 当数据库和实体类中含有date类型的数据时 ,form提交的时间数据只是string类型的,所以不能直接写入到java实体类和数据库,经过百度找到了解决方法 ,特地挪过来: 在controller中增加方法 /** * form表单提交 Date类型数据绑定 * <功能详细描述> * @param 阅读全文
posted @ 2018-12-27 15:09 小宁同学柠檬茶 阅读(1166) 评论(0) 推荐(0) 编辑
摘要: 今天在使用MyBatis执行sql语句时,出现如下异常: 执行的sql语句配置信息如下: 对应的dao接口代码为: public List<String> getColumnsByTableName(String tableName); 应该改为: 原因就在于resultType代表的是List中的 阅读全文
posted @ 2018-10-17 15:00 小宁同学柠檬茶 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 1、每次上传文件的时候,有很多iml文件容易不小心上传上去,然后报错,所以可以把这些文件取消上传 如图所示,每次提交时,都不会显示标红文件 具体操作步骤如下: 阅读全文
posted @ 2018-10-11 14:38 小宁同学柠檬茶 阅读(184) 评论(2) 推荐(0) 编辑
摘要: public static void main(String args[]) { Pattern pattern = Pattern.compile("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$"); Matcher isNum = pattern.matcher("1"); if (!isNum.matches()) { S... 阅读全文
posted @ 2018-10-10 15:05 小宁同学柠檬茶 阅读(20132) 评论(0) 推荐(0) 编辑
摘要: 语句 set names utf8;用于设定数据库编码,让中文可以正常显示。 1.创建数据库:CREATE DATABASE `database` CHARACTER SET 'utf8' COLLATE 'utf8_general_ci '; 2.创建表:CREATE TABLE `databas 阅读全文
posted @ 2018-07-03 14:00 小宁同学柠檬茶 阅读(266) 评论(0) 推荐(0) 编辑
摘要: File file = new File("a.txt"); String parentPath = file.getParent(); // null File parentDir = file.getParentFile(); // null System.out.println("parentPath="+parentPath); // 获取相对路径 file = new File("... 阅读全文
posted @ 2018-06-29 15:04 小宁同学柠檬茶 阅读(8291) 评论(0) 推荐(1) 编辑
摘要: 1、单文件上传: 2、多文件上传: 阅读全文
posted @ 2018-06-13 16:39 小宁同学柠檬茶 阅读(541) 评论(0) 推荐(0) 编辑
摘要: 一、控制台打印的程序运行时的log4j日志中包含中文乱码 在IDEA安装目录的bin目录下找到名为"idea.exe.vmoptions"的文件: 使用文本编译软件(Notepad++等)打开此文件,在文件内容从末尾追加一行设置(-Dfile.encoding=UTF-8),表示指定编码为UTF-8 阅读全文
posted @ 2018-04-02 10:14 小宁同学柠檬茶 阅读(5837) 评论(0) 推荐(0) 编辑