网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Java
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.java Singleton模式.
.用Java测试网络代码.
.DateLastAccessed 属性.
.一个用JAVA写的测算服务器响应速.
.用EJB开发在线课堂.
.KickJava.com 推出Java原代.
.课程介绍(12): SL-330 用Java技术.
.你能过关吗?J2EE面试题集锦(附答.
.JavaServer Faces框架使用的.
.最好的Java程序员免费学习材料.
.getDay 方法.
.JDBC到底是怎么连上数据库的.
.处理Java程序中的内存漏洞.
.RMI 起步.
.JUnit实战.
.JAVA使用XML作为持久存储介质实现.
.创建通过 WDO访问数据的 JSF 应用.
.我常用的邮件发送类.
.Java学习笔记_身份验证机制.
.对Java同步一些理解.

2. Building Model Components

发表日期:2008-1-5


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 人气:549
下一篇:IE6.0打印机制解析 人气:478
浏览全部Java的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐