JSP + Javabean step-by-step tutorial (2)

zhaozj2021-02-12  205

JSP Javabean step-by-step progressive tutorial (2) Source Java

[中文 JAVA Technology Network 2002-04-24]

JavaBeans and JavaServer Pages combined with the above learning, everyone should have a basic understanding of Javabean. We need to understand some specific JSP content for JavaServer Pages. We need to know some specific JSP content, let's take a look. JavaBean Related Tags in JavaServer Pages Call JavaBean has three standard labels in JavaServer Pages, that is, $ # @ 60; jsp: usebean $ # @ 62 ;, @ 60; jsp: setProperty $ # @ 62;, and $ # @ 60; jsp: getproperty $ # @ 62 ;. $ # @ 60; JSP: Usebean $ # @ 62; label $ # @ 60; jsp: usebean $ # @ 62; can define an instance of JavaBean with a certain survival and a unique ID, so JavaServer Pages recognizes by ID JavaBean can also operate JavaBean by id.Method similar statements. During the execution, $ # @ 60; jsp: usebean $ # @ 62; first try looking for a JavaBean instance that already exists with the same ID and scope value, if not, a new instance is automatically created. Its specific grammar is as follows # @ 60; jsp: usebean id = "name" scope = "page | request | session | application" typespec $ # @ 62; body $ # @ 60; / jsp: usebean $ # @ 62; TypeSpec defines the following typespec :: = class = "classname" | class = "classname" type = "type" | type = "typename" class = "classname" | beanname = "beanname" type = "type =" type = "type =" TypeName "beanname =" beanname "| type =" typeename "The table below is $ # @ 60; jsp: Usebean $ # @ 62; the meaning of the relevant attributes in the label and the definition ID attribute is the only sign of the JavaBean object, representative An instance of a JavaBean object. It has a specific existence range (Page | Request | Session | Application). The JavaBean is identified by ID in JavaServer Pages. The Scope Scope property represents the living time of the JavaBean object, which can be one of the Page, Request, Session, and Application. Class represents the Class name of the JavaBean object, with special attention to the case is exactly the same. The beanname beanname property represents the name of the bean, usually initialized through the tantiate () method of java.beans.beans class. The .type type property specifies the type of script variable definition, the default is the same as the script variable definition, the attributes in the Class, which generally use the default value $ # @ 60; jsp: setproperty $ # @ 62; label another standard label is $ # @ 60; jsp: setProperty $ # @ 62; label, it is mainly used to set the property value of the bean.

转载请注明原文地址:https://www.9cbs.com/read-6443.html

New Post(0)