Hi
I am using jstl tag library in my jsp page.
I have a table with different variable id. I then set this id into my local variable 'myID'. I then do logic test using c:when. it doesn't do test.
<?xml version="1.0" encoding="UTF-8"?>
<div xmlns:s="http://www.backbase.com/s/"
xmlns:b="http://www.backbase.com/b/"
xmlns="http://www.w3.org/1999/xhtml">
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="spring" uri="/" %>
<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>
<meta http-equiv="expires" content="Mon, 06 Jan 1990 00:00:01 GMT"/>
<style type="text/css">
.odd { background-color: #ffffcc; }
.even { background-color: #ffccff; }
</style>
<s:behavior b:name="fx-color">
<s:event b:on="mouseenter">
<s:fxstyle b:background-color="#7d8fce" b:time="250" />
</s:event>
<s:event b:on="mouseleave">
<s:variable b:name="myID" b:scope="local" b:select="./@id" />
<s:variable b:name="myID2" b:scope="local" b:value="{boolean($myID mod 2 eq 0)}" />
<s:task b:action="alert" b:value="{$myID2}" /> <== Here I am getting result fine ie true/false
<c:choose>
<c:when test="{boolean($myID mod 2 eq 0)}"> <== It is failing here, not perfoming this test
<c:set var="rowStyle" scope="page" value="odd"/>
</c:when>
<c:otherwise>
<c:set var="rowStyle" scope="page" value="even"/>
</c:otherwise>
</c:choose>
<s:fxstyle b:background-color="#ffffcc;" b:time="1000" />
</s:event>
</s:behavior>
Awaiting Approval Data ...........
<div id="productVendorsList">
<b:spacer b:width="0px" b:height="5px" />
<c:forEach var="productVendorsList" items="${productVendorsList}" varStatus="rowCounter">
<c:choose>
<c:when test="${rowCounter.count % 2 == 0}">
<c:set var="rowStyle" scope="page" value="odd"/>
</c:when>
<c:otherwise>
<c:set var="rowStyle" scope="page" value="even"/>
</c:otherwise>
</c:choose>
<div class="${rowStyle}">
<div b:behavior="fx-color" b:name="${rowCounter.count}" id="${rowCounter.count}">
<c:out value="${productVendorsList.product.product}"/>,
<c:out value="${productVendorsList.product.fullDescription}"/>
</div>
</div>
</c:forEach>
</div>
</div>
<div xmlns:s="http://www.backbase.com/s/"
xmlns:b="http://www.backbase.com/b/"
xmlns="http://www.w3.org/1999/xhtml">
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="spring" uri="/" %>
<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>
<meta http-equiv="expires" content="Mon, 06 Jan 1990 00:00:01 GMT"/>
<style type="text/css">
.odd { background-color: #ffffcc; }
.even { background-color: #ffccff; }
</style>
<s:behavior b:name="fx-color">
<s:event b:on="mouseenter">
<s:fxstyle b:background-color="#7d8fce" b:time="250" />
</s:event>
<s:event b:on="mouseleave">
<s:variable b:name="myID" b:scope="local" b:select="./@id" />
<s:variable b:name="myID2" b:scope="local" b:value="{boolean($myID mod 2 eq 0)}" />
<s:task b:action="alert" b:value="{$myID2}" /> <== Here I am getting result fine ie true/false
<c:choose>
<c:when test="{boolean($myID mod 2 eq 0)}"> <== It is failing here, not perfoming this test
<c:set var="rowStyle" scope="page" value="odd"/>
</c:when>
<c:otherwise>
<c:set var="rowStyle" scope="page" value="even"/>
</c:otherwise>
</c:choose>
<s:fxstyle b:background-color="#ffffcc;" b:time="1000" />
</s:event>
</s:behavior>
Awaiting Approval Data ...........
<div id="productVendorsList">
<b:spacer b:width="0px" b:height="5px" />
<c:forEach var="productVendorsList" items="${productVendorsList}" varStatus="rowCounter">
<c:choose>
<c:when test="${rowCounter.count % 2 == 0}">
<c:set var="rowStyle" scope="page" value="odd"/>
</c:when>
<c:otherwise>
<c:set var="rowStyle" scope="page" value="even"/>
</c:otherwise>
</c:choose>
<div class="${rowStyle}">
<div b:behavior="fx-color" b:name="${rowCounter.count}" id="${rowCounter.count}">
<c:out value="${productVendorsList.product.product}"/>,
<c:out value="${productVendorsList.product.fullDescription}"/>
</div>
</div>
</c:forEach>
</div>
</div>

Hai ishfady, It doesn't
2 November, 2007 - 13:49 — sundarHai ishfady,
It doesn't work, because Backbase is a client engine, i.e its running in browser. JSTL is server side process.
Simply,
is in client browser. but JSTL executed in server side while serving page.
You can either use backbase control statements insted of JSTL control statement. or declare your variables in JSTL.