C H A P T E R  5

useViewBean


<jato:useViewBean>

A useViewBean tag establishes the root ViewBean peer used for rendering the current JSP. Only one useViewBean tag is permitted within a JSP, and it must enclose all other JATO tags on that page. The useViewBean tag establishes a root name space for a given JSP and acts as controller during rendering of the page.

The use of the useViewBean tag causes a new scripting variable called viewBean to be defined within the scope of the enclosed tag body. When processing a useViewBean tag, the implicit scripting variables currentContainerView and currentTiledView are established. The value of the currentContainerView variable is set to the ViewBean instance referred to by this tag.

A useViewBean tag can be considered a special case of containerView tag.

Example:

<jato:useViewBean className="com.mycomp.myapp.MyViewBean">

...

</jato:useViewBean>

Attribute Name

Description

Notes

className

The fully qualified name of the ViewBean peer class. The class name is case sensitive.

Req

type

If specified, defines the type of the viewBean scripting variable defined within the scope of this tag. This allows the type of the scripting variable to be distinct from, but related to, that of the implementation class specified. The type is required to be either the specific ViewBean class itself, a superclass of the class, or an interface implemented by the class specified. The object referenced is required to be of this type, otherwise a java.lang.ClassCastException shall occur at request time when the assignment of the object referenced to the scripting variable is attempted.

If unspecified, the scripting variable is declared to be of the type specified by the className attribute.