get()與indexOf()區別
?E(list中類型參數)?get(
int
?index)?
??????????返回列表中指定位置的元素。?
int
?indexOf(Object?o)?
??????????返回列表中首次出現指定元素的索引,如果列表不包含此元素,則返回?
-
1
。?
實體關系
7中關系類型:分為單項和雙向
1
<----->
1
1
---
〉n
1
<------>
n
1
<----
n


..。。。。。。。。。。
關系數據庫模式:
。。。。。。。
。。。。。。。
抽象編程模式:
。。。。。。。
。。。。。。。
抽象持久存儲模式:
。。。。。。。
。。。。。。。
?
CabinRemotere""o

小析遠程接口
import?javax.rmi.PortableRemoteObject;

..
javax.naming.Context?jndiContext;





.
Object?ref?=?jndiContext.lookup()//為了將Context.lookup()方法的返回參數窄化為適合的類型,必須顯式的請求一個實現了所需接口的遠程引用
CabinHomeRemote?home?=?(CabinHomeRemote)PortableRemoteObject.narrow(ref,CabinHomeRemote.class);//narrow()方法有兩個參數,即需要窄化的遠程引用以及要窄化為何種類型
2,對于從一個遠程home接口查找方法返回Collection或Enumeration,由此得到一個遠程EJB對象引用時:
ShipHomeRemote?shipHome?=?
..//得到游船home
Enumeration?enum?=?shipHome.findByCapacity(2000);

while(enum.hasMoreElements())
{
???????? Object ref = enum.nextElement();
???????????? ShipRemote ship = (ShipRemote)
???????????????PortableRemoteObject.narrow(ref,ShipRemote.class);//返回一個實現了指定Remote接口的存根
}
3,當使用javax.ejb.Handle.getEJBObject()方法得到一個遠程EJB對象引用時:
???Handle handle = .....//得到Handle
???Object ref = handle.getEJBObject();
???CabinRemote cabin = (CabinRemote);
???PortableRemoteObject.narrow(ref,CabinRemote.class);
4,當使用javax.ejb.HomeHandle.getEJBHome()方法得到一個遠程EJBhome引用時:
???homeHandle home = ........//得到home Handle
???EJBHome ref = homeHandle.getEJBHome();
???CabinHomeRemoteObject.narrow(ref,CabinHomeRemote.class);
5,當使用javax.ejb.EJBMetadata.getEJBHome()方法得到一個遠程EJB home引用時:
???EJBMetaData metaDta = homeHandle.getEJBMetaData();
???EJBHome ref = homeHandle.getEJBHome();
???CabinHomeRemoteObject.narrow(ref,CabinHomeRemote.class);
6,當由人和業務方法返回一個寬(即較一般)的遠程EJB對象類型時;以下是一個假象例子:
???//officer擴展了Crewman
???ShipHomeRemote?shipHome?=?
//得到ship遠程引用????
???CrewmanRemote crew = ship.getrCrewman("Buns","john","lst liutenant");
????OfficerRemote burns = (officerRemote)
???PortableRemoteObject.narrow(ref,CabinRemote.class);
//當方法簽名中制定了遠程類型時,則不需要PortableRemoteObject.narrow();方法。
摘要: 1)通過form將數據提交到下一個頁面;
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
01
.html?
<
html
...
閱讀全文
摘要: 客戶端的驗證
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
???????表單的客戶端驗證主要是通過JavaScript來完成的。
<
htm...
閱讀全文
<%
?? //得到所有的參數名稱,一個實現 Enumeration 接口的對象生成一系列元素,每次生成一個。
??
java.util.Enumeration e=request.getParameterNames();
?? //
對所有參數進行循環
?? while(e.hasMoreElements())?
?
?? {
????? //
得到參數名
????? String name=(String)e.nextElement();
????? //
得到這個參數的所有值
????? String[] value=request.getParameterValues(name);
????? //
輸出參數名
?????
out.print("<p>");
?
????
out.print("<h3>"+name+":");
????? //
對一個參數所有的值進行循環
????? for(inti=0;i<value.length;i++)
????? {
???????? //
輸出一個參數值
????????
out.print(value[i]);
???????? if(i!=value.length-1)
????????
out.print(",");
????? }
?????
out.print("</h3></p>");
?? }
%>
分析
方法?
hasMoreElements?
?
public
?
abstract
?
boolean
?hasMoreElements()
測試該枚舉是否還有元素。?
返回值:?
如果該枚舉還有元素則為?
true
;否則為?
false
。?
nextElement?
?
public
?
abstract
?Object?nextElement()
返回該枚舉的下一個元素。?
返回值:?
該枚舉的下一個元素。?
拋出:?NoSuchElementException?
如果不存在別的元素。
摘要: 實體 Bean
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
實體?Bean?特征實體?Bean?在許多方面不同于會話?Bean。實...
閱讀全文
摘要: 關于會話beans
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
會話?Bean?特征會話?Bean?的定義特征必須與一個應用程序內的非持久獨立狀態有關。看待會話?Bean?的...
閱讀全文
?????????? EJB的構成
???? 企業Bean實例 企業Bean類的Java對象實例,他含有本地或遠程接口中定義方法的實現供業務邏輯使用。企業Bean不具備網絡能力。
???? 遠程接口? 含有企業Bean類暴露的業務方法簽名,是一Java接口。在EJB開發模型中,客戶代碼總是同本地接口或遠程接口交互,從不直接與企業Bean實例交互。遠程接口遵守Java RMI-IIOP 定義的規則,所以具有網絡功能。
??? 本地接口? 遠程接口的高性能版本(當客戶調用的企業Bean組件與客戶處在統一JVM中)。使用本地接口訪問EJB,不要經過存根,骨架,網絡調用,參數的marshal和demarshal等操作。
? EJB對象 容器生成的遠程接口實現。 它處于客戶與企業Bean的實例之間,嫩構處理中間件相關問題,而且它還具有網絡功能。
? 本地對象 EBJ對象的高性能版本
? Home 接口 EJB對象的工廠。它是Java接口,為獲得EJB對象,客戶必須使用Home接口。由于客戶能夠跨越網絡使用Home接口,因此它具有網絡功能。
Home對象? 容器生成的Home接口實現。Home對象也具有網絡功能,并遵守RMI-IIOP規則。