BBJSP CORE:Set Tag (Deprecated)

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

Description

In BBj 16.0 and higher, the set tag can be used within a BBJSP Page to bind some data to a named attribute in the BBjspPageContext.

Attributes

Attribute Name

Description

Required

Expression

Data Type

value

the value attribute is the value that should be bound to the name in the BBjspPageContext.

true

true

Object

var

the var attribute is the name to bind to a value in the BBjspPageContext.

true

true

String

Remarks

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

Example

<!DOCTYPE html/>

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

<html>
<head> 
<title><c:set></title> 
<style>
legend { padding: 0.2em 0.5em; border:1px solid green; color:green; font-size:90%; text-align:right; background-color:white; }
fieldset { border:2px solid green; -moz-border-radius:8px; -webkit-border-radius:8px; border-radius:8px; background-color:EEE;}
</style>
</head>
<body>

<%
REM === Make a String
s$ = "A String"

REM === Make a BBjVector
vect! = new BBjVector()
vect!.add("APPLES")
vect!.add("BANANAS")
vect!.add("ORANGES")
vect!.add("GRAPES")

salary = 2000
%>
<fieldset>
<legend>Simple Strings</legend>
<c:set var='S' value='Static Set' />
<c:set var='S2' value='<%= s$ %>' />
<p>"<b><c:out value="${S}" /></b>" - was set by <code><c:set var='S' value='Static Set' /></code>
<p>"<b><c:out value="${S2}" /></b>" - was set by <code><c:set var='S2' value='<%= s$ %>' /></code>
</fieldset>
<br>
<br>
<fieldset>
<legend>Numerical with calculations</legend>
<c:set var="salary" value="<%= salary %>"/>
Monthly Salary = <b><c:out value="${salary}" /></b>
<br>
<c:set var="bonus" value="${salary*10/100}"/>
Monthly Bonus = <b><c:out value="${salary*10/100}" /></b> - calculated in the expression <code>${(salary *10 / 100)}</code>
<br>
Combined Salary + Bonus = <b><c:out value="${(salary + bonus)}" /></b> - calculated in the expression <code>${(salary + bonus)}</code>
<br>
<c:set var="annualBonus" value="${salary*1.5}"/>
Annual Bonus = <b><c:out value="${annualBonus}" /></b> - calculated in the expression <code>${(salary * 1.5)}</code>
<br>
<c:set var="annual" value="${(salary + bonus) *12 + annualBonus}"/>
Annual = <b><c:out value="${annual}" /></b> - calculated in the expression <code>${(salary + bonus) *12 + annualBonus}</code>
</fieldset>
<br>
<br>
<fieldset>
<legend>A BBjVector</legend>
<c:set var='theVector' value='<%= vect! %>' />
<c:iterate data='${theVector}' id="FRUIT" >
Vectot Item = <c:out value="${FRUIT}" />
<br>
</c:iterate>
</fieldset>
</body>
</html>

See Also

BBJSP

Core Tag Library