JSP语法(12)――<jsp:useBean>

<jsp:useBean>

创建一个Bean实例并指定它的名字和作用范围.


JSP 语法
<jsp:useBean

id="beanInstanceName"

scope=
"page | request | session | application"

{

class=
"package.class" |

type=
"package.class" |

class=
"package.class" type="package.class" |

beanName=
"{package.class | <%= expression %>}" type="package.class"

}

{

/> |

> other elements </jsp:useBean>

}

例子

<jsp:useBean id=
"cart" scope="session" class="session.Carts"]

<jsp:setProperty name=
"cart" property="*"]

<jsp:useBean id=
"checking" scope="session" class="bank.Checking" >

<jsp:setProperty name=
"checking" property="balance" value="0.0"]

</jsp:useBean>

lunzi   2004-12-27 21:37:19 评论:0   阅读:1990   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog