跳到主要內容

發表文章

Struct2

Struct2 1.Hello world 環境建置        Tomcat : 6.0 版        Servlet API 2.4        JSP API 2.0        Java 5以上        先具備有servlet的環境建置基礎     建置的第一步       (1)下載 Struts2 : http://struts.apache.org/2.x/  ( 這邊是使用2.3.4.1版)        lib下的檔案為:            (2)Servlet環境建置      在Tomcat的webapps中新增一個資料夾為bank,既是我們要實做struct2的環境。             修改web.xml <!--  struct2 configuration setting --> <filter>  <filter-name>struts2</filter-name>  <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> ...

Spring 手札 第一章 基本環境設定

 spring環境設定 1. Eclipse 安裝gradle套件和spring套件 2.新增一個專案為spring資料夾並新增build.gradle檔案 build.gradle內容 : 抓取spring的套件 /* 引用 java plugin 獲得編譯 java 專案相關的 task $ */ apply plugin: 'java' /* 引用 eclipse plugin 獲得編譯 java 專案相關的 task $ */ apply plugin: 'eclipse' /* 設定 maven repository server $ */ repositories { mavenCentral() } dependencies {     compile 'org.springframework:spring-context:4.0.0.RELEASE' } 3.Run As : Gradle GUI 開始後,使用選則command line: 打上eclipse並執行 輸入 : eclipse 4. Hellow World 範例     (1) 新增 Spring Bean Configuration File 命名為 applicationContext.xml (2)建立HelloWorld.java package test; public class HelloWorld { public void show(){ System.out.println("spfing hellow world!"); } } (3) 編輯 applicationContext.xml基本屬性 id和class <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=...

Eclipse常用的設定

       由於工作上會用到Eclipse,常常有些易用性的困惱,發表此文章提供跟我有相同      困惱的人減少找文章的時間。 安裝、移除pluging     (1)  安裝pluging               從 Help 選項,選擇  Install New Software. ..,會出現 安裝對話視窗  ,然後按下       Add 按鈕設定Name : jd-eclipse(自訂)、 Loaction : http://jd.benow.ca/jd-eclipse/update      ,按下 OK      出現需要安裝的套件,打勾後,按下 Next     同意條文後,按下 Finish, 重新開啟eclipse          (2) 移除 pluging      點選 Help -> About Eclipse 會挑出一個視窗,再點選 Installation Details          選擇需要移除的外掛套件,本範例為skpet Text Editor並按下 Uninstall....     當中文顯示太小 (在此提供兩種方法)       (1) 下載 YaHei.Consolas字型       地址: YaHei.Consolas       安裝字型 : 將下載的文字檔放在 C:\Windows\Fo...

JAVA I/O處理

 I/O處理 我們可以使用Input/Output來讀取外部的檔案/資料(檔案、console、網路資料),java.io類別庫提供很多函式功能,提供程式設計師方便使用。在JAVA SE7 會新增java.nio主要是增加io新的函式功能。 IO Stream  IO分為兩種接收資料與傳送資料的模式, (1) 位元模式(Byte Stream) 位元模式下就是輸入或是輸出資料須均要以8bit的位元,要完成一個位元模組可以利用InputStream或是OutputStream來完成。 Name: 文字檔案複製 Desc : 將文字檔複製到另一個檔案   FileInputStream fis = null ; OutputStream fos = null ; try{ fis = new FileInputStream("input.txt"); fos = new FileOutputStream("output.txt") ;   int c ;   while((c = fis.read())!= -1){   fos.write(c);   } }finally{   if(fis!=null){     fis.close();   }   if(fos!=null){     fos.close(); } } (2) 字元模式(Character Streams) 字元模式主要是利用Unicode來做傳輸,當我們利用Character Stream IO做傳送時,他會自動轉成為local character的文字集,大...

JAVA 集合架構與泛型

集合架構與泛型 集合 當我們使用陣列時,作大量資料的變動會需要做很多不必要的運算動作。所以JAVA設計集合的資料結構去做這些物件大量的變更。在集合的操作上,會將型別轉為Object存入集合中。 (1)集合繼承關係 (2) Collection方法 用來對集合的物件的基本操作 Name Description boolean  add ( E  e)   將物件加入到目前集合中 boolean    addAll ( Collection <? extends  E > c)   將集合物件加入到目前集合中 void  clear ()   移除所有的集合元素 boolean  contains ( Object  o)   如果集合有符合o元素回傳true,否回傳false boolean  containsAll ( Collection <?> c)   如果該集合有符合傳入集合所有的元素者回傳true,否回傳false boolean  equals ( Object  o)   比較物件是否相等 ...