javaee復(fù)習(xí)提綱_第1頁
javaee復(fù)習(xí)提綱_第2頁
javaee復(fù)習(xí)提綱_第3頁
javaee復(fù)習(xí)提綱_第4頁
javaee復(fù)習(xí)提綱_第5頁
已閱讀5頁,還剩8頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

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)用打包部署,每個(gè)單元包含哪些內(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)容是什么?每個(gè)模塊的擴(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ù)器的動(dòng)態(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.一個(gè)JavaWeb應(yīng)用的請(qǐ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.一個(gè)Web應(yīng)用會(huì)包括哪些內(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ù)可以實(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請(qǐng)求,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),以及如何處理請(qǐng)求。Server:代表一個(gè)服務(wù)器Connector:在某個(gè)指定端口上偵聽客戶請(qǐng)求,并將獲得的請(qǐng)求交給Engine來處理Java HTTP Connector在端口8080偵聽來自客戶Browser的http請(qǐng)求AJP 1.3 Connector在端口8009偵聽來自其他Web Server(Apache)的JSP/Servlet代理請(qǐng)求Engine:將獲得的請(qǐng)求匹配到某個(gè)虛擬主機(jī)(Virtual Host)上,并把請(qǐng)求交給該Host來處理Host:代表虛擬主機(jī),每一個(gè)都和某個(gè)網(wǎng)絡(luò)域名相匹配,每一個(gè)都可部署

25、多個(gè)Web應(yīng)用(對(duì)應(yīng)不同的Context)Context:對(duì)應(yīng)一個(gè)Web應(yīng)用(由一些Servlet、HTML頁面、Java類、JSP頁面和一些其他的資源構(gòu)成)。Tomcat處理http請(qǐng)求 HYPERLINK http:/localhost:8080/HelloWorld/ http:/localhost:8080/ HYPERLINK http:/localhost:8080/HelloWorld/ Hello HYPERLINK http:/localhost:8080/HelloWorld/ World/1.請(qǐng)求被發(fā)送到本機(jī)端口8080,被Java HTTP Connector獲得;2.

26、 Connector將該請(qǐng)求交給它所在的Service的Engine來處理,并等待Engine的回應(yīng);3. Engine獲得請(qǐng)求,匹配所有虛擬主機(jī);4. Engine匹配到名為localhost的主機(jī);5. localhost主機(jī)獲得請(qǐng)求,匹配所擁有的所有Context;6. localhost主機(jī)匹配到路徑為/HelloWorld的Context7.路徑為/HelloWorld的Context獲得請(qǐng)求,在映射表中尋找對(duì)應(yīng)的Servlet;8.Context匹配到URL PATTERN為/的Servlet;9.構(gòu)造HttpServletRequest對(duì)象和HttpServletResponse

27、對(duì)象,作為參數(shù)調(diào)用該Servlet的Service方法;10. Context把執(zhí)行完之后的HttpServletResponse對(duì)象返回給localhost主機(jī);11.Host把HttpServletResponse對(duì)象返回給Engine;12. Engine把HttpServletResponse對(duì)象返回給Connector;13. Connector把HttpServletResponse對(duì)象返回給客戶Browser。Session 的兩種實(shí)現(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對(duì)象中獲得會(huì)話對(duì)象HttpSession session=request.getSession(true);true:如果會(huì)話對(duì)象不存在,一個(gè)新的會(huì)話對(duì)象將被創(chuàng)建如果不斷提交請(qǐng)求,一

29、個(gè)人可以創(chuàng)建大量的會(huì)話對(duì)象,耗盡服務(wù)器上的內(nèi)存資源好的實(shí)踐:HttpSession session=request.getSession(false);/如果會(huì)話對(duì)象不存在,不能創(chuàng)建新會(huì)話if(session=null)response.sendRedirect(“http:/login”);/強(qiáng)迫用戶登錄,成功登錄之后,才能創(chuàng)建新會(huì)話/當(dāng)用戶注銷時(shí),使會(huì)話失效-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 使用場(chǎng)景分別是什么?Session:跟蹤用戶的購(gòu)物車 導(dǎo)航信息,登錄狀態(tài)Cookie :用戶登錄ID 用戶對(duì)語言和顏色的選擇之類的偏好, 跟蹤應(yīng)用程序的使用情況,cookie.txt文件Filter使用場(chǎng)景是什么?(在什么情況下使用)(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)證可用于跨多個(gè)servlet執(zhí)行一些功能,創(chuàng)建可重復(fù)使用的功能在servlet處理請(qǐng)求之前,截獲請(qǐng)求 如:在調(diào)用servlet之前,截獲請(qǐng)求

33、,驗(yàn)證用戶身份,未經(jīng)授權(quán)的用戶遭到拒絕,而servlet不知道曾經(jīng)有過這樣的請(qǐng)求(過濾器的應(yīng)用:代碼重用 應(yīng)用安全策略 日志 為特定目標(biāo)瀏覽器傳輸XML輸出 圖像轉(zhuǎn)換、加密 動(dòng)態(tài)壓縮輸出 )Listener的使用場(chǎng)景?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)建一個(gè)實(shí)

34、例,用它處理并發(fā)請(qǐng)求編寫線程安全的類,避免使用可以修改的類變量和實(shí)例變量;修改servlet類,實(shí)現(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)建動(dòng)態(tài)內(nèi)容的JSP元素,是如何處理這些元素的?(指令、腳本、動(dòng)作(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)建和使用對(duì)象的方法有哪些?這些對(duì)象在翻譯時(shí)如何進(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動(dòng)作的作用是改善腳本、拜托Java代碼,有哪些常用動(dòng)作?標(biāo)準(zhǔn)動(dòng)作: , , In

41、clude動(dòng)作和Include指令的區(qū)別?include指令:包括其他頁面,編譯時(shí)把其他頁面的內(nèi)容加進(jìn)來,比include動(dòng)作快include標(biāo)準(zhǔn)動(dòng)作:使用RequestDispatcher,運(yùn)行時(shí)把其他頁面的內(nèi)容加進(jìn)來(包括到輸出流中)被包含的資源為變量時(shí):使用了表達(dá)式Forward 動(dòng)作 和 Redirect 動(dòng)作的區(qū)別?把當(dāng)前JSP請(qǐng)求轉(zhuǎn)發(fā)到另一個(gè)資源上與HTTP重定向的差別:HTTP重定向:response.sendRedirect(myNewURL);發(fā)送的請(qǐng)求信息又回送給客戶機(jī),讓客戶機(jī)再轉(zhuǎn)發(fā)到另一個(gè)資源上,新的URL出現(xiàn)在Web瀏覽器中,需要在服務(wù)器和客戶機(jī)之間增加一次通信for

42、ward標(biāo)準(zhǔn)動(dòng)作:使用RequestDispatcher ,JSP的轉(zhuǎn)發(fā)功能是在服務(wù)器本身上實(shí)現(xiàn)的JSP有四種作用域?qū)ο?,分別是什么?pageScope, requestScope, sessionScope, applicationScope5. JDBC兩種建立數(shù)據(jù)庫(kù)連接的方式?JDBC-ODBC橋 Native-API Partly Java事務(wù):哪些種Java事務(wù)類型? JDBC事務(wù)、JTA(Java Transaction API)事務(wù)、容器事務(wù)什么是JDBC?(簡(jiǎn)單解釋)Java數(shù)據(jù)庫(kù)連接(Java DataBase Connectivity)ODBC開放式數(shù)據(jù)庫(kù)連接使用針對(duì)于數(shù)據(jù)

43、庫(kù)的驅(qū)動(dòng)程序,提供一組用于訪問任何數(shù)據(jù)庫(kù)的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)架:由一個(gè)servlet應(yīng)答初始的請(qǐng)求;Servlet完成實(shí)際的數(shù)據(jù)處理并將結(jié)果存儲(chǔ)在bean中;Bean存儲(chǔ)在HttpSer

45、vletRequest, HttpSession, 或ServletContext中;Servlet使用RequestDispatcher的forward方法將請(qǐng)求轉(zhuǎn)發(fā)到JSP頁面;JSP頁面通過使用jsp:useBean和相應(yīng)的作用域(request, session, 或application )從bean中讀出數(shù)據(jù)。常用的MVC框架?使用框架的優(yōu)點(diǎn):把多個(gè)組件集成到一起,相互合作,協(xié)調(diào)一致的進(jìn)行工作模型:封裝應(yīng)用數(shù)據(jù)(關(guān)系數(shù)據(jù)庫(kù)或EJB),處理商業(yè)邏輯視圖:呈現(xiàn)給用戶的界面(JSP或應(yīng)用GUI)控制器:接受用戶動(dòng)作,并對(duì)應(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í),有哪些常用的設(shè)計(jì)模式?前端控制器模式消息服務(wù)JMS使用消息的應(yīng)用場(chǎng)景:電子商務(wù)應(yīng)用:進(jìn)程中的通信兩種消息應(yīng)用:隊(duì)列、主題,使用場(chǎng)景是什么:隊(duì)列:點(diǎn)對(duì)點(diǎn)消息處理 主題:發(fā)布/訂閱消息處理(pub/sub)對(duì)于消息的消費(fèi)者來說:同步、異步,應(yīng)用場(chǎng)景是什么:異步通信:不必等到所有的處理工作都完成,成功將消息插入隊(duì)列后,即可恢復(fù)處理同步:如果消息未到達(dá),消息消費(fèi)者將一直等待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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論