




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、 Java ee 概述:JavaEE 的概念:Java Platform, Enterprise Edition (Java EE) 6 is the industry standard for enterprise Java computing. Utilize 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 applications. Develo
2、pers will benefit from productivity improvements with more annotations, more POJOs, simplified packaging, and less XML configuration.分布式多層,包含哪些層?每一層有哪些組件?The Java EE platform uses a distributed multitiered application model for enterprise applications. Enterprise Information System Tier:The enterpri
3、se information system tier handles EIS software and includes enterprise infrastructure systems such as enterprise resource planning (ERP), mainframe transaction processing, database systems, and other legacy information systems.服務(wù)器以容器的形式提供服務(wù),都有哪些容器以及提供哪些服務(wù)?Container TypesJava EE server: The runtime
4、portion of a Java EE product. A Java EE server provides EJB and web containers.Java EE server, including services such as security, transaction management, JavaNaming and Directory Interface (JNDI) lookups, and remote connectivity.Enterprise JavaBeans (EJB) container: Manages the execution of enterp
5、rise beans for Java EE applications. Enterprise beans and their container run on the Java EE server.Web container: Manages the execution of web pages, servlets, and some EJB components for Java EE applications. Web components and their container run on the Java EE server.Application client container
6、: Manages the execution of application client components. Application clients and their container run on the client.Applet container: Manages the execution of applets. Consists of a web browser and Java Plug-in running on the client together.Java ee 的應(yīng)用打包部署,每個單元包含哪些內(nèi)容?A Java EE application is delive
7、red in either a Java Archive (JAR) file, a Web Archive (WAR) file, or an Enterprise Archive (EAR) file. deployment descriptors :There are two types of deployment descriptors: Java EE and runtime. Java ee 包含哪些模塊?模塊的內(nèi)容是什么?每個模塊的擴(kuò)展名是什么?Java EE module The four types of Java EE modulesEJB modules, which c
8、ontain class files for enterprise beans and an EJB deployment descriptor. *.jarWeb modules, which contain servlet class files, web files, supporting class files, GIF and HTML files, and a web application deployment descriptor. *.warApplication client modules, which contain class files and an applica
9、tion client deployment descriptor. *.jarResource adapter modules, which contain all Java interfaces, classes, native libraries, and other documentation, along with the resource adapter deployment descriptor. *.rarJava EE應(yīng)用可重用模型,哪些角色?Development RolesThe Java EE product providerdesigns and makes avai
10、lable for purchase the Java EE platform APIs, and other features defined in the Java EE specification. typically application server vendors who implement the Java EE platform according to the Java EE Platform specification.The tool providercreates development, assembly, and packaging tools used by c
11、omponent providers, assemblers, and deployers.Application Component Providercreates web components, enterprise beans, applets, or application clients for use in Java EE applications.Application Assemblerreceives application modules from component providers and assembles them into a Java EE applicati
12、on EAR file.Application Deployer and Administratorconfigures and deploys the Java EE application, administers the computing and networking infrastructure where Java EE applications run, and oversees the runtime environment.廣泛使用的web 容器Web服務(wù)器:Tomcat, ResinEJB容器: JBoss應(yīng)用服務(wù)器:IBM Websphere, Oracle WebLog
13、ic,關(guān)于Web應(yīng)用的概述Web應(yīng)用是Web應(yīng)用服務(wù)器的動態(tài)拓展,哪兩種類型?A web application is a dynamic extension of a web or application server. There are two types of web applications:Presentation-oriented: A presentation-oriented web application generates interactive web pages containing various types of markup language (HTML, XH
14、TML, XML, and so on) and dynamic content in response to requests.Service-oriented: A service-oriented web application implements the endpoint of a web service.一個JavaWeb應(yīng)用的請求處理流程。The client sends an HTTP request to the web server. A web server that implements Java Servlet and JavaServer Pages technol
15、ogy converts the request into an HTTPServletRequest object. This object is delivered to a web component, which can interact with JavaBeans components or a database to generate dynamic content. The web component can then generate an HTTPServletResponse or can pass the request to another web component
16、. A web component eventually generates a HTTPServletResponse object. The web server converts this object to an HTTP response and returns it to the client.一個Web應(yīng)用會包括哪些內(nèi)容?A web application consists of web components, static resource files such as images, and helper classes and libraries. Web container
17、Web組件可以是Servlet和web頁面,哪些技術(shù)可以實現(xiàn)Web頁面(JSP, JavaServer Faces and Facelets pages)Web應(yīng)用的一些特征可以在部署到容器是被配置,兩種配置的方式是什么? (Java EE annotations, deployment descriptor (DD))Web容器提供了哪些服務(wù)?provides such services as request dispatching, security, concurrency, and lifecycle managementWeb模塊的目錄結(jié)構(gòu)The top-level director
18、y of a web module is the document root of the application.The document root is where XHTML pages, client-side classes and archives, and static web resources, such as images, are stored.The document root contains a subdirectory named WEB-INF.WEB-INF contains the following files and directories:classe
19、s: A directory that contains server-side classes: servlets, enterprise bean class files, utility classes, and JavaBeans componentstags: A directory that contains tag files, which are implementations of tag librarieslib: A directory that contains JAR files that contain enterprise beans, and JAR archi
20、ves of libraries called by server-side classesDeployment descriptors, such as web.xml (the web application deployment descriptor) and ejb-jar.xml (an EJB deployment descriptor)ServletServlet 生命周期。The life cycle of a servlet is controlled by the container in which the servlet has been deployed.When a
21、 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 service
22、method, passing request and response objects. If the container needs to remove the servlet, it finalizes the servlet by calling the servlets destroy method.Http請求,URL組成部分包括哪些元素?http:/host:portrequest-path?query-stringThe request path is further composed of the following elements:Context path: A conc
23、atenation of a forward slash (/) with the context 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
24、 path or the servlet path.Tomcat的組件結(jié)構(gòu),以及如何處理請求。Server:代表一個服務(wù)器Connector:在某個指定端口上偵聽客戶請求,并將獲得的請求交給Engine來處理Java HTTP Connector在端口8080偵聽來自客戶Browser的http請求AJP 1.3 Connector在端口8009偵聽來自其他Web Server(Apache)的JSP/Servlet代理請求Engine:將獲得的請求匹配到某個虛擬主機(jī)(Virtual Host)上,并把請求交給該Host來處理Host:代表虛擬主機(jī),每一個都和某個網(wǎng)絡(luò)域名相匹配,每一個都可部署
25、多個Web應(yīng)用(對應(yīng)不同的Context)Context:對應(yīng)一個Web應(yīng)用(由一些Servlet、HTML頁面、Java類、JSP頁面和一些其他的資源構(gòu)成)。Tomcat處理http請求 HYPERLINK http:/localhost:8080/HelloWorld/ http:/localhost:8080/ HYPERLINK http:/localhost:8080/HelloWorld/ Hello HYPERLINK http:/localhost:8080/HelloWorld/ World/1.請求被發(fā)送到本機(jī)端口8080,被Java HTTP Connector獲得;2.
26、 Connector將該請求交給它所在的Service的Engine來處理,并等待Engine的回應(yīng);3. Engine獲得請求,匹配所有虛擬主機(jī);4. Engine匹配到名為localhost的主機(jī);5. localhost主機(jī)獲得請求,匹配所擁有的所有Context;6. localhost主機(jī)匹配到路徑為/HelloWorld的Context7.路徑為/HelloWorld的Context獲得請求,在映射表中尋找對應(yīng)的Servlet;8.Context匹配到URL PATTERN為/的Servlet;9.構(gòu)造HttpServletRequest對象和HttpServletResponse
27、對象,作為參數(shù)調(diào)用該Servlet的Service方法;10. Context把執(zhí)行完之后的HttpServletResponse對象返回給localhost主機(jī);11.Host把HttpServletResponse對象返回給Engine;12. Engine把HttpServletResponse對象返回給Connector;13. Connector把HttpServletResponse對象返回給客戶Browser。Session 的兩種實現(xiàn)機(jī)制(詳細(xì)了解)Sessions are represented by an HttpSession object. You access a s
28、ession by calling the getSession method of a request object. This method returns the current session associated with this request, or, if the request does not have a session, it creates one.從HttpServletRequest對象中獲得會話對象HttpSession session=request.getSession(true);true:如果會話對象不存在,一個新的會話對象將被創(chuàng)建如果不斷提交請求,一
29、個人可以創(chuàng)建大量的會話對象,耗盡服務(wù)器上的內(nèi)存資源好的實踐:HttpSession session=request.getSession(false);/如果會話對象不存在,不能創(chuàng)建新會話if(session=null)response.sendRedirect(“http:/login”);/強(qiáng)迫用戶登錄,成功登錄之后,才能創(chuàng)建新會話/當(dāng)用戶注銷時,使會話失效-session.invalidate() Web組件可以調(diào)用其他的外部資源,采用什么方式調(diào)用?(包含頁面進(jìn)來)Web components can invoke other web resources in two ways: ind
30、irectly and directly:1 A web component indirectly invokes another web resource when it embeds a URL that points to another web component in content returned to a client.2 A web component can also directly invoke another resource while it is executing. There are two possibilities: The web component c
31、an include the content of another resource, or it can forward a request to another resource.Session和Cookie 使用場景分別是什么?Session:跟蹤用戶的購物車 導(dǎo)航信息,登錄狀態(tài)Cookie :用戶登錄ID 用戶對語言和顏色的選擇之類的偏好, 跟蹤應(yīng)用程序的使用情況,cookie.txt文件Filter使用場景是什么?(在什么情況下使用)(The main tasks that a filter can perform are as follows:Query the request a
32、nd act accordingly.Block the request-and-response pair from passing any further.Modify the request headers and data. Modify the response headers and data.Interact with external resources.)改善代碼重用,在不修改servlet代碼的情況下向servlet添加功能;如:身份認(rèn)證可用于跨多個servlet執(zhí)行一些功能,創(chuàng)建可重復(fù)使用的功能在servlet處理請求之前,截獲請求 如:在調(diào)用servlet之前,截獲請求
33、,驗證用戶身份,未經(jīng)授權(quán)的用戶遭到拒絕,而servlet不知道曾經(jīng)有過這樣的請求(過濾器的應(yīng)用:代碼重用 應(yīng)用安全策略 日志 為特定目標(biāo)瀏覽器傳輸XML輸出 圖像轉(zhuǎn)換、加密 動態(tài)壓縮輸出 )Listener的使用場景?You can monitor and react to events in a servlets life cycle by defining listener objects whose methods get invoked when life-cycle events occur. 如何處理Servlet的線程安全問題?servlet默認(rèn)是多線程的,Server創(chuàng)建一個實
34、例,用它處理并發(fā)請求編寫線程安全的類,避免使用可以修改的類變量和實例變量;修改servlet類,實現(xiàn)SingleThreadMode1接口單線程JSPJSP生命周期: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
35、and compiles the class. During development, one of the advantages of JSP pages over servlets is that the build process is performed automatically.JSP是文本文檔,包括哪兩種類型的文本?contains two types of text: static data, JSP elementsJSP頁面有兩種語法表達(dá)方式,哪兩種?: standard and XMLJSP元素都有哪些?Directives,scripting elements,expr
36、ession language expressions,jsp:set|get,jsp:include|forward,jsp:plugin, custom tags在JSP頁面的翻譯階段,要去處理構(gòu)建動態(tài)內(nèi)容的JSP元素,是如何處理這些元素的?(指令、腳本、動作(include,forward)在翻譯是如何處理?定制標(biāo)簽如何處理?)During the translation phase each type of data in a JSP page is treated differently. Static data is transformed into code that will
37、emit the data into the response stream.JSP elements are treated as follows:Directives are used to control how the web container translates and executes the JSP page.Scripting elements are inserted into the JSP pages servlet class. Expression language expressions are passed as parameters to calls to
38、the JSP expression evaluator.jsp:set|getProperty elements are converted into method calls to JavaBeans components.jsp:include|forwardelements are converted into invocations of the Java Servlet API.The jsp:plugin element is converted into browser-specific markup for activating an applet.Custom tags a
39、re converted into calls to the tag handler that implements the custom tag.有哪些常用的JSP指令?XML語法標(biāo)準(zhǔn)語法page指令include指令Taglib指令xmlns:prefix=tag library URL腳本元素中創(chuàng)建和使用對象的方法有哪些?這些對象在翻譯時如何進(jìn)行處理?There are three ways to create and use objects in scripting elements:Instance and class variables of the JSP pages servl
40、et class are created in declarations and accessed in scriptlets and expressions.Local variables of the JSP pages servlet class are created and used in scriptlets and expressions.Attributes of scope objects are created and used in scriptlets and expressions.JSP動作的作用是改善腳本、拜托Java代碼,有哪些常用動作?標(biāo)準(zhǔn)動作: , , In
41、clude動作和Include指令的區(qū)別?include指令:包括其他頁面,編譯時把其他頁面的內(nèi)容加進(jìn)來,比include動作快include標(biāo)準(zhǔn)動作:使用RequestDispatcher,運行時把其他頁面的內(nèi)容加進(jìn)來(包括到輸出流中)被包含的資源為變量時:使用了表達(dá)式Forward 動作 和 Redirect 動作的區(qū)別?把當(dāng)前JSP請求轉(zhuǎn)發(fā)到另一個資源上與HTTP重定向的差別:HTTP重定向:response.sendRedirect(myNewURL);發(fā)送的請求信息又回送給客戶機(jī),讓客戶機(jī)再轉(zhuǎn)發(fā)到另一個資源上,新的URL出現(xiàn)在Web瀏覽器中,需要在服務(wù)器和客戶機(jī)之間增加一次通信for
42、ward標(biāo)準(zhǔn)動作:使用RequestDispatcher ,JSP的轉(zhuǎn)發(fā)功能是在服務(wù)器本身上實現(xiàn)的JSP有四種作用域?qū)ο螅謩e是什么?pageScope, requestScope, sessionScope, applicationScope5. JDBC兩種建立數(shù)據(jù)庫連接的方式?JDBC-ODBC橋 Native-API Partly Java事務(wù):哪些種Java事務(wù)類型? JDBC事務(wù)、JTA(Java Transaction API)事務(wù)、容器事務(wù)什么是JDBC?(簡單解釋)Java數(shù)據(jù)庫連接(Java DataBase Connectivity)ODBC開放式數(shù)據(jù)庫連接使用針對于數(shù)據(jù)
43、庫的驅(qū)動程序,提供一組用于訪問任何數(shù)據(jù)庫的API什么是JTA?The Java EE architecture provides a default auto commit to handle transaction commits and rollbacks. An auto commit means that any other applications that are viewing data will see the updated data after each database read or write operation.However, if your applicatio
44、n performs two separate database access operations that depend on each other, you will want to use the JTA API to demarcate where the entire transaction, including both operations, begins, rolls back, and commits.MVC基于MVC模式的JavaEE Web應(yīng)用構(gòu)架:由一個servlet應(yīng)答初始的請求;Servlet完成實際的數(shù)據(jù)處理并將結(jié)果存儲在bean中;Bean存儲在HttpSer
45、vletRequest, HttpSession, 或ServletContext中;Servlet使用RequestDispatcher的forward方法將請求轉(zhuǎn)發(fā)到JSP頁面;JSP頁面通過使用jsp:useBean和相應(yīng)的作用域(request, session, 或application )從bean中讀出數(shù)據(jù)。常用的MVC框架?使用框架的優(yōu)點:把多個組件集成到一起,相互合作,協(xié)調(diào)一致的進(jìn)行工作模型:封裝應(yīng)用數(shù)據(jù)(關(guān)系數(shù)據(jù)庫或EJB),處理商業(yè)邏輯視圖:呈現(xiàn)給用戶的界面(JSP或應(yīng)用GUI)控制器:接受用戶動作,并對應(yīng)用數(shù)據(jù)進(jìn)行適當(dāng)?shù)奶幚恚⊿ervlet)The MVC archit
46、ecture allows you to separate the view from the model via a controller.The MVC design allows for concurrent development of each component comprising the model, view and controller by different programmersAbility to react to changes:Can change the user interface without impacting business logic, for
47、example, change the text field to a list of choices.Can change the business logic without impacting the UI, for example, tax laws change every year, but UI is still amount owed or refunded.Can move location of data without impacting the UI or business logic, for example, migrate from test system to
48、production.Make it easy to incorporate new technologiesBe able to support different types of clients基于JavaEE 做應(yīng)用時,有哪些常用的設(shè)計模式?前端控制器模式消息服務(wù)JMS使用消息的應(yīng)用場景:電子商務(wù)應(yīng)用:進(jìn)程中的通信兩種消息應(yīng)用:隊列、主題,使用場景是什么:隊列:點對點消息處理 主題:發(fā)布/訂閱消息處理(pub/sub)對于消息的消費者來說:同步、異步,應(yīng)用場景是什么:異步通信:不必等到所有的處理工作都完成,成功將消息插入隊列后,即可恢復(fù)處理同步:如果消息未到達(dá),消息消費者將一直等待Synchronously: A subscriber or a receiver explicitly fetches the message from the destination by calling the receive method. The receive method can block until a message arrives or can
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年鄆城幼兒面試試題及答案
- 6-甲?;?5-(三氟甲基)煙酸乙酯hplc
- 5年級下冊英語第4單元單詞跟讀
- 5年級上冊簡易方程
- 4年級下冊日積月累1~8單元
- 地下建筑火災(zāi)案例
- 2025年云南旅游職業(yè)學(xué)院單招職業(yè)傾向性測試題庫帶答案
- 2025年天津濱海職業(yè)學(xué)院單招職業(yè)傾向性測試題庫完美版
- 2025年南充文化旅游職業(yè)學(xué)院單招職業(yè)技能測試題庫及答案1套
- 2025年重慶資源與環(huán)境保護(hù)職業(yè)學(xué)院單招職業(yè)技能測試題庫1套
- 自然環(huán)境及特征(考向3:自然環(huán)境的地域差異(雪線、林線)) 【知識精講精研】 高考地理二輪核心考點突破課堂
- GB/T 43200-2023機(jī)器人一體化關(guān)節(jié)性能及試驗方法
- 園林噴灌工程施工方案
- 紅樓夢第二回極好課件
- 混凝土回彈數(shù)據(jù)自動計算表格
- 家庭節(jié)約用水
- 《材料性能學(xué)》教案
- 道路交通事故現(xiàn)場勘查與處置
- 電噴系統(tǒng)原理及故障維修手冊
- 環(huán)境影響評價報告公示-全椒縣水務(wù)全椒縣第二自來水廠擴(kuò)建工程環(huán)境影響報告書公示全環(huán)評報告
- 名班主任工作室成員成長檔案
評論
0/150
提交評論