开发小技巧
zbd_answer
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
session过期,点击后退不跳转到登陆页面。
分享一个小技巧,有些页面需要登录后才可以使用的,如果长期不操作的话,点一下会跳回到登录页面,但是如果点浏览器的回退按钮还是可以回去的,虽然操作不了,但是还是可以看到里面的东西。 如果想避这种情况,在页面响应时添加个 HTTP 头就可以了 public static void forbidBrowserCache(HttpServletResponse response) { re原创 2014-03-18 15:55:40 · 1144 阅读 · 0 评论 -
int转6位16进制数。
public static String toHex(int x) { if (x > 0xFFFFFF || x throw new IllegalArgumentException(); } String hex = Integer.toHexString(x); char[] chars = "00 00 00".toCharArray原创 2014-04-03 17:29:55 · 1018 阅读 · 0 评论 -
根据种子生成随机数。
public class Main2 { public static void main(String[] args) { int[] nums = { 1 , 2 , 3 , 4 , 5 }; System.out.println( Arrays.toString( ran(nums , 2) )); System.out.pr原创 2014-03-25 14:09:29 · 1255 阅读 · 0 评论
分享