ApplicationarchitecturesforInteractiveWebApplications交互式Web应用程序的应用程序架构



《ApplicationarchitecturesforInteractiveWebApplications交互式Web应用程序的应用程序架构》由会员分享,可在线阅读,更多相关《ApplicationarchitecturesforInteractiveWebApplications交互式Web应用程序的应用程序架构(33页珍藏版)》请在装配图网上搜索。
1、Click to edit Master title style,Click to edit Master text styles,Second level,Third level,Fourth level,Fifth level,Application Architectures for Interactive Web Applications:Java JSP and Model/View/ControllerTechniques,Jeff Schmitt,November 16,2001,ABSTRACT,This talk is the report of my sabbatical
2、leave during Spring 2001 in,which I explored some new techniques in using the Java language to,develop interactive web applications.,Java Server Pages technology(JSP)facilitates the development of,interactive websites with dynamically generated content.JSP programs,contain ordinary HTML tags mixed w
3、ith Java code.Custom tag libraries,and Template processing are techniques which allow the Java code to be,isolated from the HTML.This application architecture is,based on the principles of Model/View/Controller.,Web Application Components,Client-typically a Web Browser,HTTP-request,response protocol
4、 between client and server,HTML files-static web content,Webserver-serves HTML files and,looks for certain request patterns,then forwards request to servlet engine,for example:,/servlet/*,Servlet Engine-supports execution of servlets,Servlet-handles request from client,generates response to client,J
5、SP Engine-supports the compilation of files into Servlets,Web Application-a collection of HTML files,Servlets and JSP pages to implement an information system on the web.,Tiered Systems,Single Tier-Mainframe,LAN,Two Tier-Client-Server,INTERNET,Database,Server,Application,Server,Web,Server,N-Tier-Web
6、 Application,Servlet Lifecycle,init(),destroy(),service(),Servlet Sequence Diagram,Client,Webserver,Servlet,request(),init(),destroy(),service(),Process request,response,response,Servlet Multithreading,Client 1,Servlet,request,Client 2,request,response,response,ServletsAdvantagesDisadvantages,Scalab
7、le,Persistent,Simple,Flexible,Support,Stable API,Run in separate memory space from Server,Servlet mapping(servlet is not a web page),Hard for Web Designer to change the HTML part of the code,HTML(presentation)and Java code(business logic)mixed together,XML Notation,Begin and end within same tag:,Beg
8、in and end as two separate tags:,Document Type Definition,Deployment Descriptor:web.xml,SnoopServlet test.SnoopServlet -454677,SnoopServlet SnoopServlet,SnoopServlet /snoop/*,:/jakarta.apache.org/taglibs/dbtags/WEB-INF/dbtags.tld,JSP-Java Server Pages,Similar to servlets,but they resemble HTML pages
9、,Placed in web folders mixed with HTML files,acts like an HTML file,Compiled automatically to a servlet when first referenced or when the file is changed by programmer.,Intended to help separate the presentation(HTML response)from the logic(processing logic).,Similar to Microsofts Application Server
10、 Pages(ASP),JSP Lifecycle,Client,Webserver,Servlet,request,service(),init(),Process request,response,response,JSP,request,JSP to Servlet,Compile Servlet,servlet,JSP scripting elements,JSP Comments,Declarations:placed in static part of servlet,Expressions:evaluate to a string,Scriptlets:any Java stat
11、ements,Template Text:inserted into response,Name:,JSP Default Objects,Object,Class,Scope,Comments,request,HttpServletRequest,Request,The client request,response,HttpServletResponse,Page,The servlet response,out,JspWriter,page,An object for writing to the output stream,session,HttpSession,Session,Cre
12、ated to track same user as they visit and return to pages in web application,application,ServletContext,Application,Allows servlets to communicate with each other,JSP Object Scope,Scope,Meaning,Page,Available to the handling page only,Request,Available to the handling page and to any servlelt or JSP
13、 that control is forwarded to or included,Session,Available to any servlet or JSP within the same session(across repeat visits to web application),Application,Available to any servlet or JSP within the same web application,Custom JSP tags,Assemble reusable JSP code for easy use,An XML-like front end
14、 to access Java programming,Designed to bridge the intersection between java programmers and web designers,Tag library holds definitions of custom tags,Custom tags save in Tag Library File,.tld,Many useful Tag Libraries exist for the common tasks such as database access,email,file access,DBTags,From
15、 Apache Jakarta project,Allow use of JDBC with Java details hidden,Easy to use,Invisible exception handling,establish connection to server,jdbc:mysql:/localhost/test,org.gjt.mm.mysql.Driver,root,notVerySecure,Statement and Query,The escapeSql tag can be used inside a SQL query to SQL-escape your inp
16、ut values if they contain single quotes.,insert into test_books(id,name)values(3,),select id,name,description from test_books order by 1,no description,JSP Action Elements,Control Tags for request-time include,Optional parameters for Control tags,Allow JSP programs to implement the Controller aspect of the Model-View-Controller architecture,JSP Forward,Client,Webserver,Servlet 1,request,service(),Process,request,response,response,JSP,request,JSP to Servlet,Compile Servlet,servlet,Servlet 2,reque
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。