<CORE:Choose>

Description

In BBj 16.0 and higher, the choose tag can be used together with the <CORE.When> and <CORE.Otherwise> tags in a BBJSP Page to control the output written to the resulting HTML output based upon the conditions specified by the <CORE.When> tags or if none apply then the <CORE.Otherwise> is used.

You can consider the combinations of <CORE.When> and <CORE.Otherwise> as being similar in functionality to SWITCH / CASE / DEFAULT.

Attributes

None.

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>&lt;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

BBJSP Page

Core Tag Library

<CORE.When>

<CORE.Otherwise>