
java
onlydo
这个作者很懒,什么都没留下…
展开
-
加密解密
密钥生成:public static void genKey() { try { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(512); KeyPair key = keyGen.generateKeyPair(); BASE64Encod...2007-08-23 17:15:39 · 88 阅读 · 0 评论 -
ehcache集群配置terracotta
terracotta下载地址:http://www.terracotta.org/dl/oss-download-catalog傻瓜式安装:java -jar terracotta-3.2.1_2-installer.jar运行:C:\terracotta\terracotta-3.2.1_2\bin>start-tc-server.batpom.xml添加以下配置:[code...原创 2010-06-01 13:47:37 · 186 阅读 · 0 评论 -
spring配置文件异常
[code="java"]100817 141034 INFO AbstractApplicationContext.java:411 Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1f9dc36: display name [org.springframework.conte...原创 2010-08-17 14:22:48 · 167 阅读 · 0 评论 -
poi使用
利用poi操作excel 备忘如下写操作:[code="java"]FileOutputStream fos = new FileOutputStream("d:/stock.xls"); HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet s = wb.createSheet(); wb.setSheetName...原创 2010-05-24 10:56:16 · 173 阅读 · 0 评论 -
JSP备忘
获取上下文${pageContext.request.contextPath}2009-12-07 10:31:52 · 84 阅读 · 0 评论 -
response.sendRedirect偶尔会失效问题
response.sendRedirect偶尔会失效,需要在重定向后的页面中添加随机的参数。[code="java"]ActionRedirect ar=new ActionRedirect(mapping.findForward("success")); ar.addParameter("id", info.getModule().getId()); ar.addParamete...2008-03-22 14:04:38 · 355 阅读 · 0 评论 -
log4j.properties
[code]#log4j.rootLogger=DEBUG,A1,R log4j.rootLogger=INFO,A1,R log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appen...2007-10-24 13:47:23 · 67 阅读 · 0 评论 -
log4j.xml样例
[code] [/code]2007-10-24 13:45:35 · 78 阅读 · 0 评论 -
AIX下使用JfreeChart问题
图形展示不出,需要在jvm上添加实参通用jvm实参-Djava.awt.headless=true2007-10-19 12:56:44 · 109 阅读 · 0 评论 -
发送cookie
[code]try { // Create a URLConnection object for a URL URL url = new URL("http://hostname:80"); URLConnection conn = url.openConnection(); // Set the coo...2007-10-16 20:16:52 · 589 阅读 · 0 评论 -
计算耗时
[code]public static String formatLongToTime(long time) { long a = time % 1000; long b = time % 60000 / 1000;// 秒 long c = time % 3600000 / 60000;// 分钟 long d = time / 3600000;// 小时 retu...2007-10-06 13:10:19 · 183 阅读 · 0 评论 -
[转]设计原则
粒度:包的内聚性原则 1) 重用发布等价原则(The Release Reuse Equivalency Principle (REP)) * 重用的粒度就是发布的粒度 * 一个可重用的包必须为发布跟踪系统所管理,使我们在新版本发布后我们还可以继续使用老版本 * 一个包中的所有类对于同一类用户来讲都应该是可重用的。2) 共同重用原则(The Common Reuse Pri...2007-08-23 19:30:23 · 89 阅读 · 0 评论 -
Base64编码问题
使用sun的base64,每到76个字符就会自动生成一个回车换行,需要使用.replaceAll("\r\n","");替换掉。2007-08-23 17:17:11 · 84 阅读 · 0 评论 -
html转码过滤和替换
oracle数据库中过滤html标签[code="sql"]select t.*, t.rowid from test tselect t.ID,t.NAME,REGEXP_REPLACE(DATA,'\','') as data from test tupdate test set data=REGEXP_REPLACE(DATA,'\','')[/code]...原创 2010-11-15 11:13:32 · 167 阅读 · 0 评论