BBJSP CORE:When Tag (Deprecated)

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

Description

In BBj 16.0 and higher, the when tag can be used within a <CORE.Choose> in a BBJSP Page to conditionally write text to the resulting HTML output that will be sent to the client browser.

Attributes

Attribute Name

Description

Required

Expression

Data Type

test

the test attribute should evaluate to an integer value where any positive number represents a TRUE state.

true

true

int

Remarks

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

The following example demonstrates using the <CORE.Choose> tag with the child <CORE.When> and <CORE.Otherwise> tags

Example

<!DOCTYPE html/>

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

<html>
<head> 
<title><c:choose></title> 
</head>
<body>
<p>
<a href='choose.bbjsp?v=<%= str(RND(7)+1) %>'>Click to try with a RANDOM number.</a>
</p>
<c:if test='${param["v"]}'>
<p>
<div style="text-align: center;font-size:150%">
The value received was : 
<c:choose>
<c:when test='${param["v"] = 1}'>ONE</c:when>
<c:when test='${param["v"] = 2}'>TWO</c:when>
<c:when test='${param["v"] = 3}'>THREE</c:when>
<c:when test='${param["v"] = 4}'>FOUR</c:when>
<c:when test='${param["v"] = 5}'>FIVE</c:when>
<c:otherwise>${param["v"]} <small>(invalid, only 1 - 5 allowed)</small></c:otherwise>
</c:choose>
</div>
</p>
</c:if>
<br>
</body>
</html>

See Also

BBJSP

Core Tag Library

<CORE.Choose>

<CORE.Otherwise>