C H A P T E R  27

content


<jato:content>

Denotes a section of JSP content that has begin<name>Display() and end<name>Display() events associated with it. The association of these events works in the same way as for visual tags, except that there need be no peer by the specified name in the parent container view.

The entire body content of this tag may be conditionally suppressed by returning a value of false from the corresponding begin<name>Display() event. If the body content is not suppressed, the processed body content will be provided to the end<name>Display() event. The body content will be fully processed, including any embedded JSP or Web Application Framework/JATO tags, before being passed to this event.

Unlike the firing of display events for the visual tags, which may be suppressed by a combination of attributes on the tag itself or its parent tag, the firing of display events for this tag always occurs. Therefore, for efficiency reasons, developers should always implement at least one of the display events for a content tag--if no events are implemented, there is no reason to use the tag.

This tag is only valid when enclosed by a useViewBean, containerView, or tiledView tag.

Example:

...

Username: <jato:textField name="username"/>

<jato:content name="superuser">

<br>

Password: <jato:textField name="password"/>

</jato:content>

<hr>

...

The above would be rendered into the following HTML if and only if the beginSuperuserDisplay() event in the current parent view returned true:

...

Username: <input type="text" name="PageFoo.username" value="scott">

<br>

Password: <input type="text" name="PageFoo.password" value="tiger">

<hr>

...

The endSuperuserDisplay() event would receive the following HTML as a method parameter:

<br>

Password: <input type="text" name="PageFoo.password" value="tiger">

If the beginSuperuserDisplay() event instead returned false, the following would be rendered:

...

Username: <input type="text" name="PageFoo.username" value="scott">

<hr>

...

The endSuperuserDisplay() event would not be invoked.


Attribute Name

Description

Notes

name

The name of the content section, used to fire display events in the current parent view.

Req

roles

A comma delimited list of role names. Role names must be limited to those declared in the deployment descriptor file (web.xml in the WEB-INF directory of the Web application). When this attribute is present, the display event is not fired. If any of the roles in the list is found in the roles of the authenticated principal (user) of the current request, then the body content of this tag will be displayed. In other words, unless the logged in user has at least one of the roles listed, the content in the JSP wrapped by this tag will be skipped.

 

negate

Valid values: "true" or "false"

 

A value of "true" negates or reverses the result of the test done by the tag based on display event or role authorization. For example, if the display event returns false or if the roles listed under the roles attribute are not satisfied, then the body of the content tag will still be displayed.

 

If not specified, "false" is assumed.