|
遇到一個需求,需要根據當前頁面的狀態動態設置定義在input上的my97日期控件的onfocus事件是否啟用。幾經周折,才搞定。 對于已經寫在input上的onfocus事件: <input?type="text"?name="finishtime"?id="finishtime"??readonly="readonly" ?onfocus=WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd?HH:mm'})?class="Wdate"> 我用jquery的unbind函數死活都解決不了。 最后只能用IE的detachEvent來解決,而用這個detachEvent又有兩個要注意的: (1)detachEvent的事件必須是先前attachEvent的。 (2)函數不能帶參數,故用了個自定義的無參的my97dp函數來中轉。 真是搞不懂,又不能專門花時間來把js事件機制搞得很清楚。 代碼如下: ?<script> ?function?my97dp(){ ?WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd?HH:mm'}); ?} ?jQuery(function(){ jQuery('#finishtime').get(0).attachEvent('onfocus',my97dp); ?var?status='${obj.status}'; ?if(status=='2'||status=='3'){ ?var?t=jQuery('#finishtime').addClass('readonly') ?.attr('readonly',true).removeClass('Wdate').get(0); ?t.detachEvent('onfocus',my97dp); ?} ?}); ?</script> ?<input?type="text"?name="finishtime"?id="finishtime"?readonly="readonly"?class="Wdate">
又叫軟件形態管理。它通過控制、記錄、追蹤對軟件的修改和每個修改生成的軟件組成部件來實現對軟件產品的管理功能。主要包括版本控制、變更控制、過程支持。這方面最出名的工具是clearcase
1,Ideogramic UML ? 可用白板涂鴉的方式畫UML,還不錯??上Р恢С种形?。收費。 ? 試用key:2oBPw-TrCRG-9FWGz-TC7Rx-Zq
2, staruml http://www.tkk7.com/daozhanga/archive/2009/03/28/262532.html
問題: 假定,Parent類有一個Set屬性,里面放的是Son。如果查詢"from Parent",某個Parent哪怕一個Son都沒有,那個Set屬性不會為null,而是一個空集合。 這時候如果你Parent newP=new Parent();然后BeanUtils.copyPropertis(newP,origP);最后就會報hibernate異常"Found shared references to a collection"。 注:hibernate在什么時機發現"兩個對象共享一個集合"的情況的?我這邊的例子是在下一次查詢時發現的。
原因: BeanUtils.copyPropertis是淺拷貝,導致這兩個對象引用的Set是同一個Set,這在hibernate中是不允許的,參見Hibernate reference第6章的"Two entities may not share a reference to the same collection
instance"。 這種問題常見于復制對象時。 如何解決:newP.setSonSet(null); 還有人說原因可能是并發操作:http://www.tkk7.com/fastzch/archive/2006/12/22/89520.html
參考: http://markmail.org/message/fszouomkeicjynw2 http://blog.csdn.net/programeyonger/archive/2008/01/31/2075304.aspx http://www.javaeye.com/topic/99505
1, BeanUtils.copyProperties(dest, orig);
???????? 這種copy是淺拷貝,復制后的2個Bean的同一個屬性可能擁有同一個對象的ref,這個在使用時要小心,特別是對于屬性為自定義類的情況.還要屬性為集合類的情況。小心hibernate的Set 2,BeanUtils.copyProperties與PropertyUtils.copyProperties的區別 ? 這兩個類幾乎有一摸一樣的功能,唯一的區別是:BeanUtils在對Bean賦值是會進行類型轉化。舉例來說也就是在copyProperty時只要屬性名相同,就算類型不同,BeanUtils也可以進行copy;而PropertyBean則可能會報錯。當然2個Bean之間的同名屬性的類型必須是可以轉化的,否則用BeanUtils一樣會報錯。
???????? 若實現了org.apache.commons.beanutils.Converter接口則可以自定義類型之間的轉化。
除BeanUtils外還有一個名為PropertyUtils的工具類,它也提供copyProperties()方法,作用與BeanUtils的同名方法十分相似,主要的區別在于后者提供類型轉換功能,即發現兩個JavaBean的同名屬性為不同類型時,在支持的數據類型范圍內進行轉換,而前者不支持這個功能,但是速度會更快一些 http://xiaozhao-521.javaeye.com/blog/244254 注意:有人說BeanUtils支持的轉換類型不包括java.util.Date? ???? 我用1.6.1版本試了BeanUtils.copyProperties,肯定是支持java.util.Date的。 3,LazyDynaBean可以實現動態的vo。 ? 這樣,有時候程序給view層的東西就可以用它來封裝而不用專門建一個多余的vo類了。
參考: http://jone0321.blogdriver.com/jone0321/615543.html http://www.tkk7.com/kenzhh/archive/2008/09/03/226592.html
1,sendRedirect 寫法:response.sendRedirect(); 服務器根據邏輯,發送一個狀態碼,告訴瀏覽器重新去請求事先訪問過的那個地址,一般來說瀏覽器會用剛才請求的所有參數重新請求,所以session,request參數都可以獲取,request.setAttribute的內容沒有了 2,include 會同時包含本頁面和include頁面的內容,地址欄不變。
?request.setAttribute的內容可以正常使用
。 servlet寫法:request.getRequestDispatcher("jsp2.jsp").include(request,???response);?? jsp寫法:<jsp:include?page="include.jsp"/> 3,forward 頁面會是forward的頁面的內容,地址欄不變
request.setAttribute的內容,可以正常使用
servlet寫法:request.getRequestDispatcher("jsp2.jsp").forward(request,???response); jsp寫法<jsp:forward?page="include.jsp"/>
以上內容主要來自 圖解sendRedirect,include,forward的區別 該文有形象的示意圖,值得一看。 4,<%@ include file="/bookshelf.jsp" %>和<jsp:include page="bookshelf.jsp" flush="true" /> 是有區別的。前者主要用于靜態內容,后者主要用于動態內容(flush='true'必加?)。 ?如果要傳遞參數,只能利用后者的<jsp:param name="" value=""/>標記,不能直接放在url后面。 參考:JSP 最佳實踐: 用 jsp:include 控制動態內容
<%@ page language="java" contentType="text/html" %> <html> <body> <jsp:include page="header.jsp" flush="true"> <jsp:param name="pageTitle" value="newInstance.com"/> <jsp:param name="pageSlogan" value=" " /> </jsp:include> <%@ include file="/navigation.jsp" %> <jsp:include page="bookshelf.jsp" flush="true" /> <jsp:include page="/mt-blogs/index.jsp" flush="true" /> <%@ include file="/footer.jsp" %> </body> </html>
1,我覺得UML里最有用的是序列圖. ?? 序列圖按照時間次序,描述對象之間如何交互,以及交互時的消息。序列圖是用例的精細化表達。一個用例可以細化為一個或多個序列圖。 ?? 用例有粒度之分,序列圖也分粗細。 參考資料: (1)用netbeans創建序列圖的教程 ?? http://hi.baidu.com/woxxf/blog/item/6ba2f6efed129b12fdfa3c15.html (2)http://hi.baidu.com/haoyan665/blog/item/61717e3f9b21d5ee54e723c6.html (3)http://ieagle.javaeye.com/blog/104956 (4) UML 中各種圖形的重要性排行 (5)在線畫時序圖:http://www.websequencediagrams.com。玩具。
1,樂觀鎖 <class name="onlyfun.caterpillar.User" table="user" optimistic-lock="version"> <id name="id" column="id"> <generator class="native"/> </id> <version name="version" column="version" access="field"/>
http://caterpillar.onlyfun.net/Gossip/HibernateGossip/OptimisticLocking.html
1,《編程珠璣:第2版》
2, Applying UML and Patterns 3,spring in Action 第二版 4,系統分析師UML實務手冊 5, UNIX編程藝術 6,The Productive Programmer 7, 程序設計實踐 8,《軟件需求最佳實踐:SERU過程框架原理與應用》 9,超越對手——軟件項目經理的18種實用技能 10,GIS for Web應用開發之道 11,Ruby for Rails中文版 http://book.csdn.net/bookfiles/393/ 12,西游記、設計模式與IBM WebSphere Portal應用開發 13,算法導論,簡稱CLR 14,大話設計模式 15,Ruby on Rails電子商務實戰 16, Effective Java 第二版 17,Business Process Management with JBOSS JBPM: A Practical Guide for Business Analysts 18,OSworkflow: A Guide for Java Developers and Architects to Integrating Open-source Business Process Management 19,The C Programming Language (2nd Edition)? 簡稱K&R ??? http://djkings.javaeye.com/blog/233107 20,編譯原理 技術與工具,第二版 ??? 編譯方面的最牛書,有人稱之為龍書 21,計算機程序的構造和解釋 ,第二版 ??? 簡稱“SICP”,用Lisp描述 22,計算機程序設計藝術,簡稱TAOCP 23,《互聯網單元測試及實踐》 24,單元測試之道Java版——使用Junit 25,JUNIT RECIPES中文版--程序員實用測試技巧 26,junit in ation 27,理解專業程序員 28, 解析極限編程 --擁抱變化(第二版) 29,測試驅動開發 by Example 30,The Algorithm Design Manual 第二版 31, POJOs IN ACTION中文版:用輕量級框架開發企業應用 32, 領域驅動設計--軟件核心復雜性應對之道 33,構建可擴展的web站點, 34,Web信息架構:設計大型網站 35, 數據倉庫(原書第4版) 36, 電力企業信息化SOAA實踐 37, Ajax高級程序設計 38, AJAX企業級開發 39, Ajax實戰:實例詳解(ajax in practice) 40, Pro Java? EE Spring Patterns: Best Practices and Design Strategies Implementing Java EE Patterns with the Spring Framework 41,EIP 企業集成模式 42,The Definitive Guide to SOA: Oracle? Service Bus, Second Edition 43,系統分析師技術指南 44,《ERP——從內部集成起步》 45,設計模式與重構 46,設計模式解析(第2版) 47, 項目管理知識體系指南(PMBOK指南)(第四版) 48,系統分析與設計? Systems Analysis and Design in a Changing World 49,系統分析與設計方法(原書第7版)
50,持續集成:軟件質量改進和風險降低之道 51,Java極限編程 52,Spring 攻略 53,java組件設計 54,物理學原理在工程技術中的應用 55,Java EE設計模式:Spring企業級開發最佳實踐 56,設計模式之禪 57,金字塔原理 58,流血的仕途 59,大思想的神奇 60,思考致富
Test Driven: TDD and Acceptance TDD for Java Developers Practical Liferay: Java–based Portal Applications Development (Pro) Beginning POJOs: Lightweight Java Web Development Using Plain Old Java Objects in Spring, Hibernate, and Tapestry (Beginning from Novice to Professional) Tapestry 5: Building Web Applications: A step-by-step guide to Java Web development with the developer-friendly Apache Tapestry framework
以下是一些新書 Practical Rails with jQuery Projects Pro Spring Persistence with Hibernate Pro Java EE Spring Patterns Pro Spring 2.5 Grails in Action Spring in Practice Open-Source ESBs in Action SOA in Practice: The Art of Distributed System Design SOA for the Business Developer: Concepts, BPEL, and SCA Service Oriented Architecture for Dummies SOA Security SOA Cookbook Open Source SOA SOA模式 SOA-based Enterprise Integration Open-Source ESBs in Action Enterprise Flexible Rails Lucene in Action, Second Edition JUnit in Action, Second Edition The Art of Unit Testing Collective Intelligence in Action Data Structures and Problem Solving Using Java Flexible Rails(已出版) Implementing SOA: Total Architecture in Practice Building SOA-Based Composite Applications Using NetBeans IDE 6 Practical Rails with jQuery Projects Pro Spring Persistence with Hibernate
1,Set里不允許重復,常用的: ? HashSet就不說了。 ? TreeSet里的元素是排過序的。自定義的類的對象默認只能存放一個,如果想放多個并且有排序,則要實現Comparable接口并加上那3個方法。詳見: TreeSet自定義排序2, http://blog.csdn.net/java2000_net/archive/2009/01/16/3796064.aspx 3, List要使用removeAll(Collection coll) 對象需實現equals()和hashCode()方法 4,用Collections.sort排序時可以把Comparator接口作為第二個參數 Collections.sort(stuGrade_List, new Comparator() { public int compare(Object o1, Object o2) { double c1 = ((StuGrade) o1).getChinese(); //獲得語文的成績,是doubel型 double c2 = ((StuGrade) o2).getChinese(); ? if(c1>c2){ return 1; }? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else if(c1=c2){ return 0; } else return -1; } }); 參考: TreeMap的使用及注意事項
|