posted @ 2013-10-29 11:22 钟悍 阅读(205) 评论(0) 推荐(0) 编辑
摘要:
public static Map getMapFromObject(Object obj) { Map map = new HashMap(); Field[] fields = obj.getClass().getDeclaredFields(); for (Field field : fields) { try { field.setAccessible(true); Object value = field.get(obj); ... 阅读全文
摘要:
String key="key"ResourceBundle bundle = ResourceBundle.getBundle("com.karl.com.example");String value = bundle.getString(key);resource file: example.properties store in packagecom.karl.com. 阅读全文
posted @ 2013-10-23 20:13 钟悍 阅读(177) 评论(0) 推荐(0) 编辑
摘要:
http://blog.csdn.net/luozhangwen/article/category/1406316 阅读全文
posted @ 2013-10-16 16:23 钟悍 阅读(390) 评论(0) 推荐(0) 编辑
摘要:
Information Apply special style for the birthdays. ... 阅读全文
posted @ 2013-10-16 13:41 钟悍 阅读(2981) 评论(0) 推荐(0) 编辑
摘要:
第一:code@RequestMapping(value = "/query/{keyword}", method = RequestMethod.GET, produces = "text/html;charset=UTF-8")public String query(@PathVariable String keyword) {}第二:tomcat server.xml 中注意:如果使用eclipse启动tomcat时,需要将workspace下面 的server.xml 中的Connector也添加URIEncoding="UTF-8&q 阅读全文
posted @ 2013-09-25 17:15 钟悍 阅读(5817) 评论(0) 推荐(0) 编辑
摘要:
import java.util.concurrent.locks.Condition;import java.util.concurrent.locks.Lock;import java.util.concurrent.locks.ReentrantLock;public class ConditionTest2 { public static void main(String[] args) { final Bussiness bussiness = new Bussiness(); final int times = 5; Thread a... 阅读全文
posted @ 2013-07-28 19:06 钟悍 阅读(317) 评论(0) 推荐(0) 编辑
摘要:
import java.util.concurrent.locks.Condition;import java.util.concurrent.locks.Lock;import java.util.concurrent.locks.ReentrantLock;public class ConditionTest { public static void main(String[] args) { final Bussiness bussiness = new Bussiness(); final int times = 5; Thread a ... 阅读全文
posted @ 2013-07-28 18:27 钟悍 阅读(475) 评论(0) 推荐(0) 编辑
摘要:
public class SpiralArray { public static int[][] generateSpiralArray(final int x, final int y) { int[][] blanks = new int[x][y]; int direct = 0; int num = 0; int posX = 0, posY = -1; int widthlen = y; int heightlen = x; int xTimes = heightlen; ... 阅读全文
posted @ 2013-07-26 12:38 钟悍 阅读(288) 评论(0) 推荐(0) 编辑
摘要:
class StackWithTwoQueue { private Queue queue1 = new LinkedList(); private Queue queue2 = new LinkedList(); public synchronized void push(E e) { if (queue1.isEmpty()) { queue2.add(e); } else { queue1.add(e); } } public synchronized E pop() th... 阅读全文
posted @ 2013-07-25 16:18 钟悍 阅读(317) 评论(0) 推荐(0) 编辑