BBJSP CORE:Template Tag (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBj 16.0 and higher, the template tag can be used in a BBJSP Page to allow easy use of fields held in a BBjTemplatedString.

Attributes

Attribute Name

Description

Required

Expression

Data Type

data

the data attribute should evaluate to a value representative of the template.

false

true

String

id

the id attribute specifies the name of the value to be stored in the BBjspPageContext.

true

true

String

template

the template attribute format for the data attribute .

false

false

String

Remarks

The Core Tag Library library needs to be referenced in the BBJSP Page

This example demonstrates using the <c:out> tag to output a value from a BBjTemplatedString .

Example

<!DOCTYPE html/>

<%-- Import the tag library --%>
<%@ taglib uri='/WEB-CFG/tld/core.tld' prefix='c' %>

<%
tpl$ = "name:c(32),price:N(12*),qty:u(1)"
t! = BBjAPI().makeTemplatedString(tpl$)
t!.setFieldValue("name","Apple")
t!.setFieldValue("price",1.20)
t!.setFieldValue("qty",3)

#PageContext!.setAttribute("template",tpl$)
System.out.println("setting item")
#PageContext!.setAttribute("theItem",t!)
System.out.println("done")
%>

<html>
<head> 
<title><c:out></title> 
</head>
<body>
<c:log message='before c:template' />
<c:template id='item' template='${template}' data='${theItem}' />
<c:log message='after c:template' />
<c:out value='${item["NAME"]}' /> 
<c:out value='${item["PRICE"]}' default='0.00' />
</body>
</html>

See Also

BBJSP

Core Tag Library