System.getProperties()
System.out.println("Java的运行环境版本:"+props.getProperty("java.version")); System.out.println("Java的运行环境供应商:"+props.getProperty("java.vendor")); System.out.println("Java供应商的URL:"+props.getProperty("java.vendor.url")); System.out.println("Java的安装路径:"+props.getProperty("java.home")); System.out.println("Java的虚拟机规范版本:"+props.getProperty("java.vm.specification.version")); System.out.println("Java的虚拟机规范供应商:"+props.getProperty("java.vm.specification.vendor")); System.out.println("Java的虚拟机规范名称:"+props.getProperty("java.vm.specification.name")); System.out.println("Java的虚拟机实现版本:"+props.getProperty("java.vm.version")); System.out.println("Java的虚拟机实现供应商:"+props.getProperty("java.vm.vendor")); System.out.println("Java的虚拟机实现名称:"+props.getProperty("java.vm.name")); System.out.println("Java运行时环境规范版本:"+props.getProperty("java.specification.version")); System.out.println("Java运行时环境规范供应商:"+props.getProperty("java.specification.vender")); System.out.println("Java运行时环境规范名称:"+props.getProperty("java.specification.name")); System.out.println("Java的类格式版本号:"+props.getProperty("java.class.version")); System.out.println("Java的类路径:"+props.getProperty("java.class.path")); System.out.println("加载库时搜索的路径列表:"+props.getProperty("java.library.path")); System.out.println("默认的临时文件路径:"+props.getProperty("java.io.tmpdir")); System.out.println("一个或多个扩展目录的路径:"+props.getProperty("java.ext.dirs")); System.out.println("操作系统的名称:"+props.getProperty("os.name")); System.out.println("操作系统的构架:"+props.getProperty("os.arch")); System.out.println("操作系统的版本:"+props.getProperty("os.version")); System.out.println("文件分隔符:"+props.getProperty("file.separator")); //在 unix 系统中是"/" System.out.println("路径分隔符:"+props.getProperty("path.separator")); //在 unix 系统中是":" System.out.println("行分隔符:"+props.getProperty("line.separator")); //在 unix 系统中是"/n" System.out.println("用户的账户名称:"+props.getProperty("user.name")); System.out.println("用户的主目录:"+props.getProperty("user.home")); System.out.println("用户的当前工作目录:"+props.getProperty("user.dir")); //通知Java您要通过代理进行连接 System.getProperties().put("proxySet","true"); //指定代理所在的服务器 System.getProperties().put("proxyHost","myProxyMachineName"); //指定代理监听的端口 System.getProperties().put("proxyPort","85");
数组转list
List<String> stringB = Arrays.asList(stringArray);
mybatis批量处理
<update id="Delete" parameterType="java.lang.String"> update TB_BASE_TYSF_ORGANISEUNIT set STATUS=0 WHERE ID in <foreach collection="list" item="ID" index="index" open="(" close=")" separator=","> #{ID} </foreach> </update>
tomcat启动端口号被占用
打开cmd 输入 netstat -ano|findstr 8341 8341是端口
taskkill /pid 1348 /f 1348和上面的对应
sqlserver 分页查询
select * from (select row_number()over(order by UserId)rownumber,* from BASE_User)a where rownumber between $1 and $10
如果放在mybatis的xml中
<!--分页前置语句--> <sql id="page"> select row_number()over(order by UserId)rownumber,* from BASE_User </sql> <!--分页查询--> <select id="getBaseUserListByPage" resultMap="BaseResultMap"> select * from (<include refid="page" />)a where rownumber between ${pageStart} and ${pageEnd} </select>
xml文件没有提示问题解决方法
1. 解决办法:在eclipse的菜单里,找到window -> preferences,点击打开窗体,然后在左栏顺次找到XML -> XML Files -> Editor -> Content Assist,在右栏找到Prompt when these characters are inserted,旁边的输入框默认是"<=:,",将其值改为"<=:.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRESTUVWXYZ(,"
2."在xml文件上点右键 -> openWith -> 选择XML Editor就可以"
mysql出现1366编码错误
解决方法 输入 show full columns from ad; 查看列的编码,然后设计表进行修改
乱码
javascript: encodeURI(value):将value转换成utf-8, decodeURI(value):将utf-8的value反转成字符串。
java: URLDecoder.decode(value, "utf-8"); URLEncoder.encode(value, "utf-8");
tomcat调优
tomcat默认是bio的,以下设置将其设为nio
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" connectionTimeout="20000" redirectPort="8443" maxThreads="500" minSpareThreads="20" acceptCount="100" disableUploadTimeout="true"
enableLookups="false" URIEncoding="UTF-8" />