C H A P T E R  9

setModelFieldValue


<jato:setModelFieldValue>

This tag invokes the Model.setValue(String,Object) method with the provided value. This tag does not render any HTML, and may be embedded within any arbitrary HTML on the page.

This tag is only valid when enclosed by a useViewBean, containerView, or tiledView tag. This tag may not contain any body content.

Example:

<jato:setModelFieldValue modelClass="com.mycompany.myapp.MyModel" name="numItems" value="8" valueType="int"/>

Attribute Name

Description

Notes

lookInSession

Valid values: "true" or "false"

A value of "true" specifies that the tag will specify to the ModelManager that it should look in the session for the model named by the modelName attribute. The modelName attribute must be specified if this attribute is specified.

If not specified, "false" is assumed.

RTExpr

name

The name of the DisplayField peer. This peer must be a child of the current parent ContainerView, TiledView, or ViewBean. The DisplayField name is resolved relative to the current parent view.

The view peer must be of type <JATO package>.view.DisplayField

Req, RTExpr

value

The value that will be passed into the DisplayField.setValue(Object) method of the specified DisplayField peer.

Req RTExpr

modelClass

The fully-qualified model class interface or implementation name (see the documentation for <JATO package>.ModelManager for more information on which class to specify). The instance returned from the ModelManager in response to this class name must implement the <JATO package>.model.Model interface.

Req, RTExpr

modelName

If specified, attempts to obtain the model named by the value of this attribute. If this attribute is not specified, a default model instance will be used. This attribute is mandatory if the lookInSession attribute is set to "true". If the lookInSession attribute is "true", the ModelManager will attempt to obtain the model from the session using the name specified by this attribute.

RTExpr

valueType

Valid values: "string", "int", "long", "float", "double", "short", "bigdecimal", "Boolean", "byte", "char", "sqldate", "sqltime", "sqltimestamp"

The type to which the string representation of the value attribute will be converted before being set on the target DisplayField. The type conversion from the string representation must be legal or an exception will be thrown.

If this attribute is omitted, the set value will be of type String.