posts - 22, comments - 17, trackbacks - 0, articles - 15
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          日歷

          <2007年1月>
          31123456
          78910111213
          14151617181920
          21222324252627
          28293031123
          45678910

          搜索

          •  

          2007年1月4日

          1Mark

          posted @ 2014-10-13 15:57 碼農cz 閱讀(115) | 評論 (0)編輯 收藏

          2Mark

          posted @ 2014-10-13 15:57 碼農cz 閱讀(113) | 評論 (0)編輯 收藏



          至此,準備工作就可以了。

          看看頁面怎么寫的

          運行,就可以了。

          posted @ 2014-10-13 15:50 碼農cz 閱讀(168) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2012-07-18 15:07 碼農cz 閱讀(856) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2012-07-18 14:45 碼農cz 閱讀(1276) | 評論 (0)編輯 收藏

          在struts2中,獲取表單元素有三種方式:
          1.在action類中,為屬性提供get/set方法。
          2.使用javabean的引用,提供get/set方法。但是表單中名字必須是javabean引用的名字.屬性名。
          3.實現Modeldriven接口。

          posted @ 2012-07-05 14:59 碼農cz 閱讀(187) | 評論 (0)編輯 收藏

               摘要: 說實話,eclipse我受夠了.自從用了Intellijidea ,我的腰不酸了,腿不疼了,一口氣能上一層樓.先上代碼結構數據庫表結構 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 CREATE DATABASE...  閱讀全文

          posted @ 2012-07-05 14:48 碼農cz 閱讀(269) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-05-15 10:42 碼農cz 閱讀(955) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-05-15 10:39 碼農cz 閱讀(6542) | 評論 (8)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-05-15 10:37 碼農cz 閱讀(1748) | 評論 (3)編輯 收藏

               摘要:   閱讀全文

          posted @ 2008-05-14 09:24 碼農cz 閱讀(244) | 評論 (0)編輯 收藏

          Map接口:
              |
              + -- WeakHashMap: 以弱鍵 實現的基于哈希表的 Map。在 WeakHashMap 中,當某個鍵不再正常使用時,將自動移除其條
              |      目。更精確地說,對于一個給定的鍵,其映射的存在并不阻止垃圾回收器對該鍵的丟棄,這就使該鍵成為可終止的,被終
              |      止,然后被回收。丟棄某個鍵時,其條目從映射中有效地移除,因此,該類的行為與其他的 Map 實現有所不同。此實現
              |      不是同步的。
              |
              + -- TreeMap:該映射根據其鍵的自然順序進行排序,或者根據創建映射時提供的 Comparator 進行排序,具體取決于使用的
              |    構造方法。此實現不是同步的。
              |
              + -- HashMap:基于哈希表的 Map 接口的實現。此實現提供所有可選的映射操作,并允許使用 null 值和 null 鍵。(除了      
              |        非同步和允許使用 null 之外,HashMap 類與 Hashtable 大致相同。)此類不保證映射的順序,特別是它不保證該順   
              |       序恒久不變。此實現不是同步的。
              |
              +-- SortedMap: 進一步提供關于鍵的總體排序 的 Map。該映射是根據其鍵的自然順序進行排序的,或者根據通常在創建有
                   序映射時提供的 Comparator 進行排序。對有序映射的 collection 視圖(由 entrySet、keySet 和 values 方法返回
                   )進行迭代時,此順序就會反映出來。要采用此排序方式,還需要提供一些其他操作(此接口是 SortedSet 的對應映
                   射)。

          Collection接口:
              |
              + -- Set接口:一個不包含重復元素的 collection。更正式地說,set 不包含滿足 e1.equals(e2) 的元素對 e1 和 e2,并
              |      |     且最多包含一個 null 元素。正如其名稱所暗示的,此接口模仿了數學上的 set 抽象。
              |      |
              |      + -- HashSet:此類實現 Set 接口,由哈希表(實際上是一個 HashMap 實例)支持。它不保證 set 的迭代順序;
              |      |    特別是它不保證該順序恒久不變。此類允許使用 null 元素。此類為基本操作提供了穩定性能,此實現不是同
              |      |    步的。
              |      |
              |      + -- LinkedHashSet:具有可預知迭代順序的 Set 接口的哈希表和鏈接列表實現。此實現與 HashSet 的不同之外在
              |      |    于,后者維護著一個運行于所有條目的雙重鏈接列表。此鏈接列表定義了迭代順序,即按照將元素插入到 set
              |      |    中 的順序(插入順序)進行迭代。注意,插入順序不 受在 set 中重新插入的 元素的影響。此實現不是同步
              |      |    的。
              |      |
              |      + -- TreeSet:基于 TreeMap 的 NavigableSet 實現。使用元素的自然順序對元素進行排序,或者根據創建 set 時
              |           提供的 Comparator 進行排序,具體取決于使用的構造方法。此實現為基本操作(add、remove 和 contains)
              |           提供受保證的 log(n) 時間開銷。此實現不是同步的。
              |
              + -- List接口:有序的 collection(也稱為序列)。此接口的用戶可以對列表中每個元素的插入位置進行精確地控制。用戶
                     |      可以根據元素的整數索引(在列表中的位置)訪問元素,并搜索列表中的元素。
                     |
                     + -- ArrayList:List 接口的大小可變數組的實現。實現了所有可選列表操作,并允許包括 null 在內的所有元素。
                     |    除了實現 List 接口外,此類還提供一些方法來操作內部用來存儲列表的數組的大小。(此類大致上等同于
                     |    Vector 類,除了此類是不同步的。)每個 ArrayList 實例都有一個容量。該容量是指用來存儲列表元素的數
                     |    組的大小。它總是至少等于列表的大小。隨著向 ArrayList 中不斷添加元素,其容量也自動增長。并未指定增
                     |    長策略的細節,因為這不只是添加元素會帶來分攤固定時間開銷那樣簡單。此實現不是同步的。
                     |
                     + -- LinkedList:List 接口的鏈接列表實現。實現所有可選的列表操作,并且允許所有元素(包括 null)。除了實
                     |    現 List 接口外,LinkedList 類還為在列表的開頭及結尾 get、remove 和 insert 元素提供了統一的命名方
                     |    法。這些操作允許將鏈接列表用作堆棧、隊列或雙端隊列。提供先進先出隊列操作(FIFO)。此實現不是同步的。
                     |
                     + -- Vector:Vector 類可以實現可增長的對象數組。與數組一樣,它包含可以使用整數索引進行訪問的組件。但是
                          ,Vector 的大小可以根據需要增大或縮小,以適應創建 Vector 后進行添加或移除項的操作。此實現是同步的
                          。

          posted @ 2007-04-18 11:18 碼農cz 閱讀(332) | 評論 (0)編輯 收藏

               摘要:   閱讀全文

          posted @ 2007-03-13 16:22 碼農cz 閱讀(948) | 評論 (0)編輯 收藏

          自從用上了tomcat5.5,發現日志信息沒了,出錯了也找不著有用的信息,上apache找答案,果然

          Tomcat 5.5 uses Commons Logging throughout its internal code allowing the developer to choose a logging configuration that suits their needs, e.g java.util.logging or Log4J. Commons Logging provides Tomcat the ability to log hierarchially across various log levels without needing to rely on a particular logging implementation.

          An important consequence for Tomcat 5.5 is that the <Logger> element found in previous versions to create a localhost_log is no longer a valid nested element of <Context>. Instead, the default Tomcat configuration will use java.util.logging. If the developer wishes to collect detailed internal Tomcat logging (i.e what is happening within the Tomcat engine), then they should configure a logging system such as java.util.logging or log4j as detailed next

          習慣用log4j來配置log信息的輸出。

          新建log4j.properties,內容為

          log4j.rootLogger=info,Console,R

          log4j.appender.Console=org.apache.log4j.ConsoleAppender
          log4j.appender.Console.layout=org.apache.log4j.PatternLayout
          #log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
          log4j.appender.Console.layout.ConversionPattern=%d{yy-MM-dd HH:mm:ss} %5p %c{1}:%L - %m%n

          log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
          log4j.appender.R.File=${catalina.home}/logs/tomcat.log
          log4j.appender.R.layout=org.apache.log4j.PatternLayout
          log4j.appender.R.layout.ConversionPattern=%d{yyyy.MM.dd HH:mm:ss} %5p %c{1}(%L):? %m%n

          log4j.logger.org.apache=info, R
          log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=DEBUG, R
          log4j.logger.org.apache.catalina.core=info, R
          log4j.logger.org.apache.catalina.session=info, R

          最后四行是tomcat的信息,如果改為debug日志文件將十分龐大。

          將這個文件放入${catalina.home}/common/classes下,再將log4j.jar和commons-logging.jar放入${catalina.home}/common/lib下,就可以在${catalina.home}/logs/下見到日志了。

          posted @ 2007-01-09 18:42 碼農cz 閱讀(1406) | 評論 (0)編輯 收藏

          我在做項目時曾碰到這個問題,怎樣動態地添加一個文本框或文件域,這在網上很容易找到。但對怎樣處理提交的動態數據就很少有這方面的信息了。本人翻閱了一些資料,把自己的方法寫了下來,以饗讀者。

          1.提交表單

          ?

          <html>
          <body>
          ?<form?name
          = " form " ?method = " post " ?action = " add.jsp " >
          ???<input?name
          = " button " ?type = button?onClick = 'additem( " tb " )'?value = " 添加>> " >
          ?<table?id
          = " tb " >
          ?</table>
          <script?language
          = " javascript " >

          function?additem(id)
          {
          ??var?row
          , cell , str ;
          ??row? = ?eval( " document.all[ " +' " '+id+' " '+ " ] " ).insertRow() ;
          ??if(row?! = ?null?)
          ?????{
          ????????cell?
          = ?row.insertCell() ;
          ????????str = " <input?type= " +' " '+ " text " +' " '+ " ?name= " +' " '+ " StuName " +' " '+ " ><input?type= " +' " '+ " button " +' " '+ " ?value= " +' " '+ " 刪除 " +' " '+ " ?onclick='deleteitem(this, " +' " '+ " tb " +' " '+ " );'> "
          ???cell.innerHTML
          = str ;

          ??????}
          }
          function?deleteitem(obj
          , id)
          {
          ??var?rowNum
          , curRow ;
          ??curRow? = ?obj.parentNode.parentNode ;
          ??rowNum? = ?eval( " document.all. " +id).rows.length?-? 1 ;
          ??eval( " document.all[ " +' " '+id+' " '+ " ] " ).deleteRow(curRow.rowIndex) ;
          }
          </script>
          ???<p>
          ?????<input?type
          = " submit " ?name = " submit " ?value = " 提交 " >
          ???</p>
          ?</form>
          </body>
          </html>

          ?

          2.處理數據

          < body >
          < table? border ="1" >< tr >< td? colspan ="2" > eg </ td ></ tr >
          <%
          Enumeration?params
          = request.getParameterNames();
          while (params.hasMoreElements()){
          String ?name = ( String )params.nextElement();
          String []?values = request.getParameterValues(name);
          if (name.equals( " StuName " )){
          %>
          < tr >
          < td > <% = name %> </ td >
          < td >
          <%
          for ( int ?index = 0 ;index < values.length;index ++ ){
          %>
          <% = values[index] %>
          <% }} %>
          </ td >
          </ tr >
          </ table >
          </ body >

          posted @ 2007-01-04 14:44 碼農cz 閱讀(1430) | 評論 (1)編輯 收藏

          主站蜘蛛池模板: 汝南县| 楚雄市| 平顶山市| 固安县| 乐亭县| 册亨县| 冀州市| 安福县| 洞头县| 双牌县| 怀来县| 伊春市| 洛川县| 勐海县| 稻城县| 台南县| 理塘县| 荔浦县| 丹江口市| 惠州市| 华蓥市| 荥阳市| 翁牛特旗| 交城县| 汉源县| 南康市| 察隅县| 犍为县| 涟水县| 宁河县| 开平市| 澄江县| 休宁县| 巫山县| 米脂县| 页游| 襄垣县| 承德县| 内丘县| 吕梁市| 三河市|