请教 ... 的区别

dr2tr 2006-04-23 10:24:17
书上说:
a jsp:useBean element results in a new bean being instantiated only if no bean with the same id and scope can be found. If a bean with the id and scope is found, the preexisting bean is simply bound to the variable referenced by id.

但实际上,我通过程序的测试发现,<jsp:useBean .... />根本就是执行了create,而不是bound啊

能解释一下吗?
...全文
224 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
yzk0370 2006-04-23
  • 打赏
  • 举报
回复
<tag>...</tag>是标准的标签配对方式,不过如果标签是单边的就要用<tag.../>方式
junjunok 2006-04-23
  • 打赏
  • 举报
回复
在CREATE时<jsp:useBean> .... </jsp:useBean>似乎比<jsp:useBean .... />好用,BOUND么正相反
zhangxp2006 2006-04-23
  • 打赏
  • 举报
回复
这两个应该是没有区别的
dr2tr 2006-04-23
  • 打赏
  • 举报
回复
《core Servlet and Java》
“the statement between (<jsp:useBean> .... </jsp:useBean>) executed only if a new bean is created, not if an existing bean is used. "

这个应该是比较正确的说法
sheep219 2006-04-23
  • 打赏
  • 举报
回复
up
lip009 2006-04-23
  • 打赏
  • 举报
回复
有那么一点点区别,如果你要给这个javaBean设置参数,你就必须用
<jsp:useBean>
<jsp:setProperty></jsp:setProperty>
</jsp:useBean>这种写法
dr2tr 2006-04-23
  • 打赏
  • 举报
回复
但是这段话如何理解呢?
a jsp:useBean element results in a new bean being instantiated only if no bean with the same id and scope can be found. If a bean with the id and scope is found, the preexisting bean is simply bound to the variable referenced by id.

from: Java Servlet Programming(Jason Hunter)

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧