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。然而,
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):
service
method) 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"/>
新闻热点
疑难解答