JSP語(yǔ)法(12)
發(fā)表時(shí)間:2024-06-06 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]<jsp:useBean> 創(chuàng)建一個(gè)Bean實(shí)例并指定它的名字和作用范圍. JSP 語(yǔ)法<jsp:useBean id="beanInstanceName" scope="page request session application&...
<jsp:useBean> 創(chuàng)建一個(gè)Bean實(shí)例并指定它的名字和作用范圍.
JSP 語(yǔ)法
<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>