template:put

 < Day Day Up > 



<template:put />

The <template:put /> tag is used to store the content of a particular URL or text (URIs or text) into the request scope. This tag is the parent to one or more put tags. The put tags specify the content to be inserted into the template. The layout of the content is determined by get tags placed in the template. The <template:put /> tag has no body and supports four attributes, described in Table 19.2.

Table 19.2: <template:put /> Tag Attributes

Attribute

Description

name

Identifies the name of the attribute to be stored in the request. The name attribute should match the name attribute of the <template:get /> tag being used to retrieve it. (Required)

role

Specifies the role in which the user must exist for this tag to be evaluated. If the user does not exist in the name role, then the tag is ignored. If no role is named, then the tag will be evaluated by default. (Optional)

content

Specifies the content that will be stored in the request. This value can be a URI or static text. If this value is not included, then the body of the tag will be used as the content and the direct attribute must be set to true. (Optional)

direct

If set to true, indicates that the content attribute or body is printed to the request; if set to false (the default), the content is included. (Optional)

start sidebar

The <template:put /> tag must be nested within a <template:insert /> tag.

end sidebar

A sample code snippet using the <template:put /> tag is shown here:

 <%@ taglib uri="/WEB-INF/tlds/struts-template.tld"   prefix="template" %> <template:insert template="/chapterTemplate.jsp">   <template:put name="title" content="Templates"     direct="true" />   <template:put name="header" content="/header.html" />   <template:put name="sidebar" content="/sidebar.jsp" />   <template:put name="content" content="/introduction.html"/>   <template:put name="footer" content="/footer.html" /> </template:insert> 



 < Day Day Up > 



Professional Jakarta Struts
Professional Jakarta Struts (Programmer to Programmer)
ISBN: 0764544373
EAN: 2147483647
Year: 2003
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net