<jsp:useBean> | |
The <jsp:useBean> action associates a Java bean with a name in one of the JSP scopes and makes it available as a scripting variable. An attempt is first made to find a bean with the specified name in the specified scope. If it's not found, a new instance of the specified class is created. Of the optional attributes, at least one of class or type must be specified. If both are specified, class must be assignable to type. The beanName attribute must be combined with the type attribute and is not valid with the class attribute. The action is processed in these steps:
Example: <jsp:useBean id="clock" class="java.util.Date" /> |
beanName | String |
Request-time value accepted: yes | |
Optional. The name of the bean, as expected by the instantiate() method of the Beans class in the java.beans package. |
class | String |
Request-time value accepted: no | |
Optional. The fully qualified class name for the bean. |
id | String |
Request-time value accepted: no | |
Mandatory. The name to assign to the bean in the specified scope and the name of the scripting variable. |
scope | String |
Request-time value accepted: no | |
Optional. The scope for the bean: one of page, request, session, or application. The default is page. |
type | String |
Request-time value accepted: no | |
Optional. The fully qualified type name for the bean (i.e., a superclass or an interface implemented by the bean's class). |