国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

2. Building Model Components

2019-11-18 11:31:29
字體:
來源:轉載
供稿:網友

2. Building Model Components

2.1 Overview

Many requirements documents used for building web applications focus on the View. However, you should ensure that the PRocessing required for each submitted request is also clearly defined from the Model's perspective. In general, the developer of the Model components will be focusing on the creation of javaBeans classes that support all of the functional requirements. The precise nature of the beans required by a particular application will vary widely depending on those requirements, but they can generally be classified into several categories discussed below. However, a brief review of the concept of "scope" as it relates to beans and jsp is useful first.
很多對于創建web應用的需求文檔關注于View。然而,

2.2 JavaBeans and Scope

Within a web-based application, JavaBeans can be stored in (and accessed from) a number of different collections of "attributes". Each collection has different rules for the lifetime of that collection, and the visibility of the beans stored there. Together, the rules defining lifetime and visibility are called the scope of those beans. The JavaServer Pages (JSP) Specification defines scope choices using the following terms (with the equivalent servlet API concept defined in parentheses):

  • page - Beans that are visible within a single JSP page, for the lifetime of the current request. (Local variables of the service method)
  • request - Beans that are visible within a single JSP page, as well as to any page or servlet that is included in this page, or forwarded to by this page. (Request attributes)
  • session - Beans that are visible to all JSP pages and servlets that participate in a particular user session, across one or more requests. (Session attributes)
  • application - Beans that are visible to all JSP pages and servlets that are part of a web application. (Servlet context attributes)

It is important to remember that JSP pages and servlets in the same web application share the same sets of bean collections. For example, a bean stored as a request attribute in a servlet like this:

MyCart mycart = new MyCart(...);
request.setAttribute("cart", mycart);

is immediately visible to a JSP page which this servlet forwards to, using a standard action tag like this:

<jsp:useBean id="cart" scope="request"
class="com.mycompany.MyApp.MyCart"/>

2.3 ActionForm Beans

Note: While ActionForm beans often have properties that correspond to properties in your Model beans, the form beans themselves should be considered a Controller component. As sUCh, they are able to transfer data between the Model and View layers.




下一篇:1. Introduction

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 微山县| 永兴县| 都匀市| 濮阳县| 林西县| 兰州市| 寿阳县| 临泉县| 上高县| 抚远县| 屏边| 张掖市| 阿坝县| 奉新县| 遵义县| 宁武县| 民权县| 阿合奇县| 仲巴县| 花莲市| 盘山县| 塔河县| 盱眙县| 方城县| 宝清县| 蓬莱市| 启东市| 香港 | 浮梁县| 龙山县| 合水县| 庆阳市| 荥阳市| 张掖市| 襄垣县| 鄱阳县| 枝江市| 江永县| 宜阳县| 潜山县| 祁门县|