




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、J2EE考點(diǎn)(簡(jiǎn)答題,問(wèn)答題)概述J2EE是分布式的,多層的框架,有哪些層?每層有哪些組件?industry standard for enterprise Java computingUtilize the new, lightweight Java EE 6 Web Profile to create next-generation web applications, and the full power of the Java EE 6 platform for enterprise applicationsThe aim of the JavaTM Platform, Enterpri
2、se Edition (Java EE) platform is to provide developers a powerful set of APIs while reducing development time, reducing application complexity, and improving application performance introduces a simplified programming modelApplication logic is divided into components according to function, and the v
3、arious application components (that make up a Java EE application )are installed on different machines (depending on the tier in the multitiered Java EE environment to which the application component belongs). Client-tier components run on the client machineweb client/thin client: dynamic web pages
4、containing various types of markup language (HTML, XML, and so on)Applets application client: typically has a graphical user interface (GUI) created from the Swing or the Abstract Window Toolkit (AWT) APIThe JavaBeansTM Component Architecture Web-tier components run on the Java EE serverJava Servlet
5、, JavaServer Faces, and JavaServer PagesTM (JSPTM) Business-tier components run on the Java EE serverEnterprise JavaBeansTM (EJBTM) Enterprise information system (EIS)-tier software runs on the EIS serverenterprise infrastructure systems such as enterprise resource planning (ERP), mainframe transact
6、ion processing, database systems, and other legacy information systems 是通過(guò)容器管理的,容器對(duì)每層提供什么服務(wù)?The Java EE security model lets you configure a web component or enterprise bean so that system resources are accessed only by authorized users.The Java EE transaction model lets you specify relationships amo
7、ng methods that make up a single transaction so that all methods in one transaction are treated as a single unit.JNDI lookup services provide a unified interface to multiple naming and directory services in the enterprise so that application components can access these services.The Java EE remote co
8、nnectivity model manages low-level communications between clients and enterprise beans. After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual machineJ2EE有哪些開(kāi)發(fā)角色?The Java EE product providerdesigns and makes available for purchase the Java EE platform A
9、PIs, and other features defined in the Java EE specification. typically application server vendors who implement the Java EE platform according to the Java EE 5 Platform specification.The tool providercreates development, assembly, and packaging tools used by component providers, assemblers, and dep
10、loyers.Application Component Providercreates web components, enterprise beans, applets, or application clients for use in Java EE applications.Application Assembler receives application modules from component providers and assembles them into a Java EE application EAR file.Application Deployer and A
11、dministrator configures and deploys the Java EE application, administers the computing and networking infrastructure where Java EE applications run, and oversees the runtime environment.ServletServlet生命周期The life cycle of a servlet is controlled by the container in which the servlet has been deploye
12、d.When a request is mapped to a servlet, the container performs the following steps.1. If an instance of the servlet does not exist, the web containera. Loads the servlet class.b. Creates an instance of the servlet class.c. Initializes the servlet instance by calling the init method. 2. Invokes the
13、service method, passing request and response objects. If the container needs to remove the servlet, it finalizes the servlet by calling the servlets destroy method. 容器提供哪些服務(wù)A web container provides services such as request dispatching, security, concurrency, and life-cycle management. It also gives
14、web components access to APIs such as naming, transactions, and email.URL組成部分 HYPERLINK http:/host:portrequest-path?query-string http:/host:portrequest-path?query-stringThe request path is further composed of the following elements:Context path: A concatenation of a forward slash (/) with the contex
15、t root of the servlets web application.Servlet path: The path section that corresponds to the component alias that activated this request. This path starts with a forward slash (/).Path info: The part of the request path that is not part of the context path or the servlet path.Web.xml常用標(biāo)簽*servlet-na
16、me的含義首先,初始化參數(shù)、定制的URL模式以及其他定制通過(guò)此注冊(cè)名而不是類名引用此servlet 其次,可在URL而不是類名中使用此名稱可使用http:/host:port/webAppPrefix/Hello代替http:/host:port/webAppPrefix/servlet.HelloServlet (以Tomcat為例)Session兩種實(shí)現(xiàn):URL重寫(xiě),cookies 分別怎么實(shí)現(xiàn)1、當(dāng)用戶第一次訪問(wèn)站點(diǎn)創(chuàng)建一個(gè)新的會(huì)話對(duì)象(Httpsession), Server分配一個(gè)唯一的會(huì)話標(biāo)識(shí)號(hào)(sessionID);Servlet容器自動(dòng)處理sessionID的分配盡可能長(zhǎng),確保
17、安全把sessionID信息放到HttpSession對(duì)象中2、Server創(chuàng)建一個(gè)暫時(shí)的HTTP cookiecookie存儲(chǔ)這個(gè)sessionID(名:jsessionid)Server將cookie添加到HTTP響應(yīng)中Cookie被放置到客戶機(jī)瀏覽器中,存儲(chǔ)到客戶機(jī)硬盤(pán) 客戶瀏覽器發(fā)送包含Cookie的請(qǐng)求;4、根據(jù)客戶機(jī)瀏覽器發(fā)送的sessionID信息(cookie),Server找到相應(yīng)的HttpSession對(duì)象,跟蹤會(huì)話5、在會(huì)話超時(shí)間隔期間,如果沒(méi)有接收到新的請(qǐng)求, Server將刪除此會(huì)話對(duì)象用戶又訪問(wèn)該站點(diǎn),必須重新注冊(cè),確保安全 Cookie被客戶禁用時(shí),采用URL重寫(xiě)
18、機(jī)制:調(diào)用reponse.encodeURL(URL)方法;http:/;jsessionid=.1、5與Cookie機(jī)制相同2、Server將sessionID放在返回給客戶端的URL中;3、客戶瀏覽器發(fā)送的請(qǐng)求將包含sessionID; 4、根據(jù)包含請(qǐng)求的sessionID信息(URL),Server找到相應(yīng)的HttpSession對(duì)象,跟蹤會(huì)話Tomcat組織結(jié)構(gòu),里面的xml看一下,給一個(gè)請(qǐng)求,它如何處理Server 代表一個(gè)服務(wù)器,可包含多個(gè)Service 可包含一個(gè)Engine,多個(gè)Connector 代表通信接口 可包含多個(gè)Host 可包含多個(gè)Context HYPERLINK
19、http:/localhost:8080/HelloServlet/ http:/localhost:8080/ HYPERLINK http:/localhost:8080/HelloServlet/ HelloServlet HYPERLINK http:/localhost:8080/HelloServlet/ / 1.請(qǐng)求被發(fā)送到本機(jī)端口8080,被Coyote Http/1.1 Connector獲得;2. Connector將該請(qǐng)求交給它所在的Service的Engine來(lái)處理,并等待Engine的回應(yīng);3. Engine獲得請(qǐng)求,匹配所有虛擬主機(jī);4. Engine匹配到名為lo
20、calhost的主機(jī);5. localhost主機(jī)獲得請(qǐng)求,匹配所擁有的所有Context;6. localhost主機(jī)匹配到路徑為/HelloServlet的Context;cookie,session的應(yīng)用場(chǎng)景過(guò)濾器、監(jiān)聽(tīng)器的應(yīng)用場(chǎng)景Applications of filters include authentication, logging, image conversion, data compression, encryption, tokenizing streams, XML transformations, and so on. 代碼重用應(yīng)用安全策略日志為特定目標(biāo)瀏覽器傳輸XM
21、L輸出圖像轉(zhuǎn)換、加密動(dòng)態(tài)壓縮輸出monitor and react to events in a servlets life cycle by defining listener objects whose methods get invoked when life-cycle events occurJSP(不考表達(dá)式語(yǔ)言和標(biāo)準(zhǔn)標(biāo)簽庫(kù))JSP生命周期A JSP page services requests as a servlet. Thus, the life cycle and many of the capabilities of JSP pages (in particular th
22、e dynamic aspects) are determined by Java Servlet technology.When a request is mapped to a JSP page, the web container first checks whether the JSP pages servlet is older than the JSP page. If the servlet is older, the web container translates the JSP page into a servlet class and compiles the class
23、. During development, one of the advantages of JSP pages over servlets is that the build process is performed automatically兩種部分組成:靜態(tài),動(dòng)態(tài)(JSP元素)JSP元素有哪些指令元素,腳本元素,動(dòng)作元素JSP指令有哪些用于訪問(wèn)JavaBean以名-值對(duì)的形式為其他標(biāo)簽提供附加信息1.產(chǎn)生與客戶端游覽器相關(guān)的HTML標(biāo)簽,有時(shí)還需要下載java插件,并插件中執(zhí)行指定的applet或javabean2.包含多個(gè),向Applet或者Javabean提供參數(shù)3.給指定的java
24、插件不能啟動(dòng)時(shí)顯示給用戶一段文字 這兩者都是前者的一部分,且只能在前者中使用,用于動(dòng)態(tài)定義一個(gè)XML元素的標(biāo)簽用于在XMl中定義一個(gè)動(dòng)作屬性的值,在element中指定輸出元素的屬性用于定義元素的內(nèi)容用于封裝模板數(shù)據(jù)用于輸出XML聲明和文檔類型聲明 JSP腳本元素有哪些1.聲明2.腳本段3.表達(dá)式 JSP隱式對(duì)象有哪些1.request2.response3.session 4.application 5.config6. pageContext7. Out8. page9. exception JSP有哪些作用域?qū)ο?.Page范圍 2.Request范圍 3.Session范圍 4.App
25、lication范圍 MVC控制流程1. Client makes a request (Web browser).2. Servlet gets the clients request.3. Servlet determines which program elements (JavaBeans, EJBs or other objects) are required to carry out the specified request.4. JavaBeans or EJBs perform the business logic operations for the servlet, an
26、d encapsulate the results.5. Servlet selects a presentation template (JSP) for delivering the content back to the client.6. The JSP generates a specific response by accessing the resultant content available through the JavaBeans.JMS、Java Mail應(yīng)用場(chǎng)景web前端為顧客訂貨錄入系統(tǒng)倉(cāng)庫(kù)管理系統(tǒng):接受訂單、配送貨品、把訂單轉(zhuǎn)交發(fā)貨系統(tǒng)發(fā)貨系統(tǒng):更新顧客的賬號(hào)紀(jì)錄
27、,開(kāi)始發(fā)貨異步傳遞消息JMS兩種消息域:點(diǎn)對(duì)點(diǎn),發(fā)布訂閱,他們的應(yīng)用場(chǎng)景點(diǎn)對(duì)點(diǎn)消息傳送1 多個(gè)生成方可向一個(gè)隊(duì)列發(fā)送消息。生成方可共享連接或使用不同連接,但它們均可訪問(wèn)同一隊(duì)列2 多個(gè)接收者可使用一個(gè)隊(duì)列中的消息,但每條消息只能由一個(gè)接收者使用。3 接收者可共享連接或使用不同連接,但它們均可訪問(wèn)同一隊(duì)列4 發(fā)送者和接收者之間不存在時(shí)間上的相關(guān)性5 可在運(yùn)行時(shí)動(dòng)態(tài)添加和刪除發(fā)送者和接收者,即可根據(jù)需要擴(kuò)展或收縮消息傳送系統(tǒng)6 消息在隊(duì)列中的放置順序與發(fā)送順序相同,但它們的使用順序則取決于消息失效期、消息優(yōu)先級(jí)以及使用消息時(shí)是否使用選擇器等因素發(fā)布/ 訂閱消息傳送1 多個(gè)生成方可向一個(gè)主題發(fā)布消息
28、。生成方可共享連接或使用不同連接,但它們均可訪問(wèn)同一主題2 多個(gè)訂戶可使用一個(gè)主題中的消息。訂戶可檢索發(fā)布到一個(gè)主題中所有消息訂戶可共享連接或使用不同連接,但它們均可訪問(wèn)同一主題。3 長(zhǎng)期訂戶可能處于活動(dòng)狀態(tài),也可能處于非活動(dòng)狀態(tài)。在它們處于非活動(dòng)狀態(tài)時(shí),代理會(huì)為它們保留消息4 可在運(yùn)行時(shí)動(dòng)態(tài)添加和刪除發(fā)布者和訂戶,這樣,即可根據(jù)需要擴(kuò)展或收縮消息傳送系統(tǒng)。消息發(fā)布到主題的順序與發(fā)送順序相同,但它們的使用順序則取決于消息失效期、消息優(yōu)先級(jí)以及使用消息時(shí)是否使用選擇器等因素5 發(fā)布者與訂戶之間存在時(shí)間上的相關(guān)性:主題訂戶只能使用在它創(chuàng)建訂閱后發(fā)布的消息JMS消費(fèi)者:同步,異步 之間的差別消息的傳
29、遞是異步的,客戶機(jī)程序在消息到達(dá)之前,可以做其他事情。receive()方法:如果有可用的消息,返回這個(gè)消息,否則將一直等待receiveNoWait()方法:如果有可用的消息,返回這個(gè)消息,否則返回NULLreceive(long timeout)方法:根據(jù)給定的超時(shí)參數(shù)制定的時(shí)間等待一個(gè)消息的到來(lái),如果在這個(gè)時(shí)間之內(nèi)有可用的消息,返回這個(gè)消息,如果超時(shí)后仍沒(méi)有可用的消息,返回NULLJ2EE容器提供聲明性安全和編程性安全Declarative security expresses an application components security requirements using d
30、eployment descriptors.Deployment descriptors are external to an application, and include information that specifies how security roles and access requirements are mapped into environment-specific security roles, users, and policies. Programmatic security is embedded in an application and is used to
31、make security decisions.Programmatic security is useful when declarative security alone is not sufficient to express the security model of an application. EJBEJB3.0有哪些EJB類型Session Bean目錄結(jié)構(gòu)既包括EJB又包括應(yīng)用模塊的目錄結(jié)構(gòu)JNDI提供什么服務(wù)為不同的目錄提供一個(gè)共同的接口;學(xué)習(xí)單一的API可以訪問(wèn)所有類型的目錄服務(wù)器;structs架構(gòu)是什么樣的結(jié)構(gòu),M是什么,V是什么,C是什么Hibernate與Java
32、持久性API的比較Hibernate工作:配置文件里面有哪些主要的標(biāo)簽標(biāo)簽:name屬性為映射的對(duì)象,table屬性為映射的表標(biāo)簽:代表主鍵,column屬性指定表中字段,type屬性指定User實(shí)例中userID的類型標(biāo)簽: column屬性指定表中字段,type屬性指定對(duì)象中屬性的類型可能編寫(xiě)什么類DAO模式:數(shù)據(jù)訪問(wèn)對(duì)象在Java EE中是怎么用到的?使用數(shù)據(jù)訪問(wèn)對(duì)象來(lái)抽象和封裝對(duì)數(shù)據(jù)源的所有訪問(wèn)。數(shù)據(jù)訪問(wèn)對(duì)象負(fù)責(zé)管理與數(shù)據(jù)源的連接,來(lái)獲取和儲(chǔ)存其中的數(shù)據(jù)。數(shù)據(jù)訪問(wèn)對(duì)象實(shí)現(xiàn)與數(shù)據(jù)源相關(guān)的訪問(wèn)機(jī)制。 數(shù)據(jù)源可以是關(guān)系型數(shù)據(jù)庫(kù)管理系統(tǒng),可以是像B2B EXCHANGE這樣的內(nèi)部服務(wù),可以是L
33、DAP庫(kù),或者也可以是通過(guò)CORBA IIOP 或者是低層sockets來(lái)訪問(wèn)的商業(yè)服務(wù). 依賴于DAO的商業(yè)組件只對(duì)他的客戶端暴露一些非常簡(jiǎn)單的DAO外部接口. DAO將數(shù)據(jù)源的實(shí)現(xiàn)細(xì)節(jié)對(duì)客戶端完全的隱藏了起來(lái). 因?yàn)?暴露給客戶端的DAO接口在低層數(shù)據(jù)源的實(shí)現(xiàn)發(fā)生改變時(shí)并不會(huì)隨著改變,所以這種設(shè)計(jì)模式使得DAO可以適應(yīng)不同的數(shù)據(jù)儲(chǔ)存方式類型而不影響客戶端和商業(yè)組件.最主要的, DAO還在組件和數(shù)據(jù)源之間扮演著協(xié)調(diào)者的角色.以下是DAO設(shè)計(jì)模式中各個(gè)模塊的解釋:1 BusinessObject指的是數(shù)據(jù)客戶端,他通常需要去訪問(wèn)數(shù)據(jù)源以獲得數(shù)據(jù)或儲(chǔ)存數(shù)據(jù).一個(gè)BusinessObject除了訪
34、問(wèn)數(shù)據(jù)源的servlet或者h(yuǎn)elper bean之外也可以是會(huì)話BEAN,實(shí)體BEAN以及一些其他的JAVA對(duì)象.2 DataAccessObject 是這個(gè)設(shè)計(jì)模式的核心部分, DataAccessObject為BusinessObject抽象了底層的數(shù)據(jù)訪問(wèn)實(shí)現(xiàn)的細(xì)節(jié),使得訪問(wèn)數(shù)據(jù)變得透明. BusinessObject還將數(shù)據(jù)的裝載和儲(chǔ)存交給了DataAccessObject進(jìn)行代理.3 DataSource他表示的是數(shù)據(jù)源的實(shí)現(xiàn). 一個(gè)數(shù)據(jù)源可以四像關(guān)系型數(shù)據(jù)庫(kù)管理體統(tǒng)這樣的數(shù)據(jù)庫(kù),可以是面向?qū)ο笮偷臄?shù)據(jù)庫(kù)管理系統(tǒng),可以是XML文檔,也可以是簡(jiǎn)單文件等等. 當(dāng)然他也可以是其他的系統(tǒng),
35、(遺留系統(tǒng),大型主機(jī)),可以是服務(wù)(B2B服務(wù),信用卡局服務(wù))或者是像LDAP這樣的數(shù)據(jù)庫(kù)等.4 TransferObject他代表的是傳遞對(duì)象,一般用于數(shù)據(jù)的載體. DataAccessObject使用傳遞對(duì)象來(lái)將數(shù)據(jù)返回給客戶端. DataAccessObject也可以使用傳遞對(duì)象來(lái)從客戶端接受數(shù)據(jù)來(lái)將原先數(shù)據(jù)庫(kù)中的數(shù)據(jù)進(jìn)行更新.優(yōu)點(diǎn)與缺點(diǎn):DAO設(shè)計(jì)模式帶來(lái)的好處.1 透明化:商業(yè)對(duì)象可以在完全不知道數(shù)據(jù)源如何具體實(shí)現(xiàn)的情況下來(lái)使用數(shù)據(jù)源. 訪問(wèn)數(shù)據(jù)源是透明的,因?yàn)閷?shí)現(xiàn)細(xì)節(jié)已經(jīng)被隱藏進(jìn)了DAO.2 遷移簡(jiǎn)單化:DAO層的出現(xiàn),使得應(yīng)用程序向不同的數(shù)據(jù)庫(kù)實(shí)現(xiàn)進(jìn)行遷移變的容易.商業(yè)對(duì)象可以對(duì)底層數(shù)據(jù)實(shí)現(xiàn)一無(wú)所知.這樣,遷移只涉及到了對(duì)DAO層的修改.3 減少在商業(yè)對(duì)象中的編程難度.由于DAO管理著所有的數(shù)據(jù)訪問(wèn)細(xì)節(jié),因而大大簡(jiǎn)化了在商業(yè)對(duì)象和其他使用DAO的數(shù)據(jù)客戶端里的代碼.所有的實(shí)現(xiàn)細(xì)節(jié)相關(guān)的代碼比如(SQL 語(yǔ)句)都包含在DAO而不在商業(yè)對(duì)象中. 這樣使得代碼變的更加健壯而且大大提高
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 培訓(xùn)機(jī)構(gòu)住宿管理辦法
- 現(xiàn)代教育技術(shù)支持下的教學(xué)模式創(chuàng)新研究
- 杭州概算控制管理辦法
- 粉末冶金鈦合金快速燒結(jié)過(guò)程研究:微觀組織變化及其機(jī)制
- 社區(qū)治理中的“老有所為”與積極老齡化路徑探索
- 園區(qū)低頻噪音管理辦法
- “數(shù)實(shí)融合”在皮革行業(yè)高質(zhì)量發(fā)展中的作用研究
- 公務(wù)接待超市管理辦法
- 干濕和氧化條件下生物炭對(duì)溶液中Cd2吸附機(jī)制的研究
- 農(nóng)墾食品安全管理辦法
- 辦公室副主任考試試題及答案詳解
- 《電火花檢漏儀校準(zhǔn)規(guī)范試驗(yàn)報(bào)告》
- 克拉瑪依市公安局招聘警務(wù)輔助人員考試真題2024
- 供應(yīng)蒸汽服務(wù)合同協(xié)議書(shū)
- 中國(guó)機(jī)器人工程市場(chǎng)調(diào)研報(bào)告2025
- 2025年金融科技企業(yè)估值方法與投資策略在金融科技企業(yè)并購(gòu)中的應(yīng)用案例報(bào)告
- 《無(wú)人機(jī)介紹》課件
- 2025-2030中國(guó)硼酸行業(yè)市場(chǎng)發(fā)展現(xiàn)狀及競(jìng)爭(zhēng)格局與投資研究報(bào)告
- 學(xué)校中層干部選拔聘用實(shí)施方案中層干部選聘實(shí)施方案2
- 生物必修1教師用書(shū)
- 園藝植物育種學(xué)知到課后答案智慧樹(shù)章節(jié)測(cè)試答案2025年春浙江大學(xué)
評(píng)論
0/150
提交評(píng)論