- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
J2EE与中间件技术——MVC
J2EE与中间件技术 ——MVC MVC技术 大多数复杂应用需要使用几种不同的方式查看和操作数据:对数据显示所作的任何修改,都需要在所有相关位置进行 当数据操作逻辑、格式化和显示代码同用户事件处理混杂在一起的时候,应用维护变得非常困难,特别是在时间跨度非常大的情况下 MVC技术 如果应用逻辑已经同现有界面的代码混合在一起,用户界面就不能被重新利用 增加功能要求对现有的代码进行多处修改,而这些需要修改的位置很难发现 对单独一段代码进行修改会造成深远的副作用 MVC技术 Web应用具有非常复杂的用户交互模型:若干不同的表单向同一个页面发送数据,或同一个表单中的数据需要发送到不同的页面中 Web应用需要支持国际化语言环境,且具有许多不同的视图 MVC技术 Model View Controller(模型视图控制器) MVC技术 MVC技术 把多个组件集成到一起,相互合作,协调一致的进行工作 模型:封装应用数据(关系数据库或EJB),处理商业逻辑 视图:呈现给用户的界面(JSP或应用GUI) 控制器:接受用户动作,并对应用数据进行适当的处理(Servlet) MVC技术 The MVC architecture 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 programmers. MVC技术 Ability to react to changes: Can change the user interface without impacting business logic, for 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 production. Make it easy to incorporate new technologies Be able to support different types of clients MVC技术 Web Application Control Flow 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, and encapsulate the results. Web Application Control Flow 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. 从Servlet调用JSP 1. 重定向: resp.sendRedirect(“/DateDisplay.jsp”); 低效率——要求客户机再发出另一个HTTP请求 2. RequestDispatcher机制: 利用ServletContext ServletContext RequestDispatcher机制 ServletContext:包含Web应用的配置信息,Servlet需要的某些外
文档评论(0)