1 / 6
文档名称:

JavaServer Pages (JSP) 1-0简单介绍 ---III(2).txt

格式:txt   页数:6
下载后只包含 1 个 TXT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

JavaServer Pages (JSP) 1-0简单介绍 ---III(2).txt

上传人:管理资源吧 2011/9/11 文件大小:0 KB

下载得到文件列表

JavaServer Pages (JSP) 1-0简单介绍 ---III(2).txt

文档介绍

文档介绍:×÷Õߣºwhitefox
email: whitefox.******@corp.
ÈÕÆÚ£º2000-7-4 19:45:50
The jsp:useBean Action
This action lets you load in a JavaBean to be used in the JSP page. This is a a very useful capability because it lets you exploit the reusability of Java classes without sacrificing the convenience that JSP adds over servlets alone. The simplest syntax for specifying that a bean should be used is:
<jsp:useBean id="name" class="" />
This usually means "instantiate an object of the class specified by class, and bind it to a variable with the name specified by id." However, as we'll see shortly, you can specify a scope attribute that makes the bean associated with more than just the current page. In that case, it is useful to obtain references to existing beans, and the jsp:useBean action specifies that a new object is instantiated only if there is no existing one with the same id and scope. Now, once you have a bean, you can modify its properties via jsp:setProperty, or by using a scriptlet and calling a method explicitly on the object with the variable name specified earlier via the id attribute. Recall that with beans, when you say "this bean has a property of typeX called foo", you really mean "this class has a method called getFoo that returns something of type X, and another method called setFoo that takes an X as an argument." The jsp:setProperty action is discu