java
java對象序列化數組和反序列化
摘要: java對象序列化數組和反序列化
閱讀全文
posted @
2011-09-16 10:51 Ke 閱讀(5335) |
評論 (0) 編輯
使用response方法清除瀏覽器緩存
摘要: response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
閱讀全文
posted @
2011-02-12 17:19 Ke 閱讀(959) |
評論 (0) 編輯
config.getServletContext().getRealPath("/")返回NULL的解決辦法
摘要: java.net.URL url = this.getClass().getResource("/");
String mSchemaPath = url.getFile();
if (mSchemaPath != null || !mSchemaPath.equals("")) {
String separator = "/";
int lastSlash = mSchemaPath.lastIndexOf(separator);
if (lastSlash == -1) {
separator = "\\";
lastSlash = mSchemaPath.lastIndexOf(separator);
}
prefix = mSchemaPath.substring(0, lastSlash);
閱讀全文
posted @
2010-12-03 22:06 Ke 閱讀(2433) |
評論 (0) 編輯
ServletContext Properties 操作文件
摘要: FileOutputStream fos = null;
try {
new File(sc.getRealPath("WEB-INF") + "/" + optionsFilename).delete();
fos = new FileOutputStream(sc.getRealPath("WEB-INF") +
"/" + optionsFilename);
props.store(fos, null);
fos.flush();
result = "Options have been saved.";
} catch (IOException e) {
log.error("Error saving contact:");
閱讀全文
posted @
2010-03-09 22:19 Ke 閱讀(500) |
評論 (0) 編輯
日記過濾器
摘要: filterConfig.getServletContext().log(
"User access! " +
" User IP: " + address +
" Resource: " + file +
" Milliseconds used: " + (System.currentTimeMillis() - start)
);
閱讀全文
posted @
2009-12-21 10:35 Ke 閱讀(261) |
評論 (0) 編輯
spring注解入門(轉)
摘要:
的base-package屬性指定了需要掃描的類包,類包及其遞歸子包中所有的類都會被處理。
還允許定義過濾器將基包下的某些類納入或排除。Spring支持以下4種類型的過濾方式:
* 過濾器類型 表達式范例 說明
* 注解 org.example.SomeAnnotation 將所有使用SomeAnnotation注解的類過濾出來
* 類名指定 org.example.SomeClass 過濾指定的類
* 正則表達式 com\.kedacom\.spring\.annotation\.web\..* 通過正則表達式過濾一些類
* AspectJ表達式 org.example..*Service+ 通過AspectJ表達式過濾一些類
閱讀全文
posted @
2009-09-15 15:20 Ke 閱讀(378) |
評論 (0) 編輯
Java調用Oracle函數
摘要: Java調用Oracle函數
閱讀全文
posted @
2009-05-12 10:27 Ke 閱讀(6367) |
評論 (2) 編輯
URLConnection在類里執行URL
摘要: HttpURLConnection urlcon = (HttpURLConnection)url.openConnection();
閱讀全文
posted @
2009-03-20 13:49 Ke 閱讀(652) |
評論 (0) 編輯
Java中的內部類和匿名類
摘要: 內部類:一個內部類的定義是定義在另一個內部的類。
原因是:
1.一個內部類的對象能夠訪問創建它的對象的實現,包括私有數據。
2.對于同一個包中的其他類來說,內部類能夠隱藏起來。
3.匿名內部類可以很方便的定義回調。
4.使用內部類可以非常方便的編寫事件驅動程序。
閱讀全文
posted @
2007-11-16 22:57 Ke 閱讀(303) |
評論 (0) 編輯
類之間的關系
摘要: UML把類之間的關系分為以下5種.
● 關聯:類A與類B的實例之間存在特定的對應關系
● 依賴:類A訪問類B提供的服務
● 聚集:類A為整體類,類B為局部類,類A的對象由類B的對象組合而成
● 泛化:類A繼承類B
● 實現:類A實現了B接口
閱讀全文
posted @
2007-10-21 19:36 Ke 閱讀(367) |
評論 (0) 編輯