随笔分类 -  00.Java & j2ee

摘要:JS压缩,CSS压缩https://developers.google.com/closure/compiler/docs/overviewhttp://yui.github.com/yuicompressor/ 阅读全文
posted @ 2013-01-05 17:04 庚武 阅读(209) 评论(0) 推荐(0) 编辑
摘要:There is a trimWhiteSpaces directive that should accomplish this,In your JSP:<%@ page trimDirectiveWhitespaces="true" %>Or in the jsp-config section your web.xml (Note that this works starting from servlet specification 2.5.):<jsp-config> <jsp-property-group> <url-patt 阅读全文
posted @ 2012-09-22 17:17 庚武 阅读(270) 评论(0) 推荐(0) 编辑
摘要:http://www.51testing.com/?uid-350678-action-viewspace-itemid-805441JDK的配置从oracle 官网下载 jrockit-jdk1.6.0_29-R28.2.0-4.1.0-linux-x64.bin ,到centos上,我将jrockit-jdk1.6.0_29-R28.2.0-4.1.0-linux-x64.bin 放在了 /opt下。# cd /opt# chmod 777 jrockit-jdk1.6.0_29-R28.2.0-4.1.0-linux-x64.bin# ./jrockit-jdk1.6.0_29-R... 阅读全文
posted @ 2012-09-12 00:29 庚武 编辑
摘要://TCPServer.javapackage msb.demo.socket;import java.io.DataInputStream;import java.io.DataOutputStream;import java.io.IOException;import java.net.ServerSocket;import java.net.Socket;import java.util.Date;public class TCPServer { /** * @param args * @throws IOException * @throws InterruptedExcepti... 阅读全文
posted @ 2012-08-30 21:42 庚武 阅读(594) 评论(0) 推荐(0) 编辑
摘要://Meal.javapackage producer.consumer.demo;public class Meal { private final int orderNum; public Meal(int orderNum) { this.orderNum = orderNum; } public String toString() { return "Meal " + orderNum; }}//Chef.javapackage producer.consumer.demo;import java.util.concurrent.TimeUnit;publ... 阅读全文
posted @ 2012-08-30 15:21 庚武 阅读(255) 评论(0) 推荐(0) 编辑
摘要:Cooperation between tasksAs you’ve seen, when you use threads to run more than one task at a time, you can keep one task from interfering with another task’s resources by using a lock (mutex) to synchronize the behavior of the two tasks. That is, if two tasks are stepping on each other over a shar.. 阅读全文
posted @ 2012-08-28 15:43 庚武 阅读(373) 评论(0) 推荐(0) 编辑
摘要:http://www.allimant.org/javadoc/index.php 阅读全文
posted @ 2012-08-13 15:20 庚武 阅读(199) 评论(0) 推荐(0) 编辑
摘要:http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/querycriteria.html使用Criteria進行查詢時,不僅僅能組合出SQL中where子句的功能,還可以組合出如排序、統計、分組等的查詢功能。排序您可以使用Criteria進行查詢,並使用org.hibernate.criterion.Order對結果進行排序,例如使用Oder.asc(),指定根據”age”由小到大排序(反之則使用desc()):Criteria criteria = session.createCriteria(User.class);crite 阅读全文
posted @ 2012-08-07 15:20 庚武 阅读(162) 评论(0) 推荐(0) 编辑
摘要:最近下载了eclipse-jee-helios-win32.zip版,使用起来没感觉到什么变化,就是以前的Web项目上在打开的时候,总是在验证的时候弹出错误:Errors occurred during the build.Errors running builder 'JavaScript Validator' on project '##'.java.lang.NullPointerException要解决这个问题,要就把JavaScript Validator去掉。去掉的方法是:选择一个项目—-右键Properties—-Builders(排二个)—-点一 阅读全文
posted @ 2012-08-06 17:10 庚武 阅读(5232) 评论(0) 推荐(0) 编辑
摘要:<session-config> <enable-cookies>false</enable-cookies> <enable-url-rewriting>true</enable-url-rewriting> <use-persistent-store/> <!-- <save-mode>on-shutdown</save-mode> --> <session-timeout>40</session-timeout> <file-store>WEB- 阅读全文
posted @ 2012-08-02 17:07 庚武 阅读(671) 评论(0) 推荐(0) 编辑
摘要:package com.cg.foo;// Generated 2012-7-19 11:40:57 by Hibernate Tools 3.4.0.CR1import java.util.Date;import java.util.HashSet;import java.util.Set;/** * TUser generated by hbm2java */public class TUser implements java.io.Serializable { private long id; private String name; private String nickname; p 阅读全文
posted @ 2012-07-21 11:36 庚武 阅读(231) 评论(0) 推荐(0) 编辑
摘要:CREATE table t_card(id bigint identity primary key,card_no varchar(50),person_id bigint foreign key references t_user(id) on delete cascade unique) <?xml version="1.0"?><!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN""http://hibernate. 阅读全文
posted @ 2012-07-19 12:05 庚武 阅读(221) 评论(0) 推荐(0) 编辑
摘要:package com.cg.tests;import java.util.regex.Matcher;import java.util.regex.Pattern;import org.junit.Test;public class TestPatternMatcher { @Test public void TestReplaceAll(){ String s="Hello World ..."; String s2=s.replaceAll("\\.", ""); System.out.println(s2); String s 阅读全文
posted @ 2012-07-09 22:43 庚武 阅读(208) 评论(0) 推荐(0) 编辑
摘要:package com.cg.tests;import java.text.SimpleDateFormat;import java.util.Calendar;import java.util.GregorianCalendar;import java.util.TimeZone;import org.junit.Test;public class TestCalendar { @Test public void testCalendar(){ /**按年月日构造日期时间对象**/ GregorianCalendar cal =new GregorianCalendar(1988, 1... 阅读全文
posted @ 2012-07-08 22:40 庚武 阅读(463) 评论(0) 推荐(0) 编辑
摘要:public static <T extends Comparable<? super T>> void sort(List<T> list) { Object[] a = list.toArray(); Arrays.sort(a); ListIterator<T> i = list.listIterator(); for (int j=0; j<a.length; j++) { i.next(); i.set((T)a[j]); } } From: JDK Collections.sort方法 阅读全文
posted @ 2012-07-07 15:02 庚武 阅读(155) 评论(0) 推荐(0) 编辑
摘要:package com.xx.tests;import java.util.HashMap;import java.util.Map;public enum Season { Spring { @Override public String toString() { return "春天"; } }, Summer{ @Override public String toString() { return "夏天"; } }, Autumn{ @Override public String toString() { return "秋天" 阅读全文
posted @ 2012-07-07 09:39 庚武 阅读(307) 评论(0) 推荐(0) 编辑
摘要:package com.cg.test;import java.nio.charset.Charset;import java.util.Iterator;import java.util.Map;import java.util.Set;import org.apache.commons.codec.binary.Hex;public class HexString { /** * @param args */ public static void main(String[] args) throws Exception { String s="1a国"; Sy... 阅读全文
posted @ 2012-07-06 17:05 庚武 阅读(927) 评论(0) 推荐(0) 编辑
摘要:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId& 阅读全文
posted @ 2012-07-06 01:59 庚武 编辑
摘要:http://www.eclipse.org/nebula/Nebula is a place where different Eclipse-Projects and Independent developers collaborate on building Custom SWT widgets and reuseable UI-Components useable in UI-Applications built using SWT and JFace.All Nebula components are available on the navigation tree on the le 阅读全文
posted @ 2012-07-05 18:05 庚武 阅读(480) 评论(0) 推荐(0) 编辑
摘要:http://sourceforge.net/projects/jalopy/http://jalopy.sourceforge.net/existing/index.htmlOverviewJalopy is a source code formatter for the Sun Java programming language. It layouts any valid Java source code according to some widely configurable rules; to meet a certain coding style without putting a 阅读全文
posted @ 2012-07-05 01:27 庚武 阅读(1436) 评论(0) 推荐(0) 编辑