Hi
I have a table and rows. row has a behavior defined in it with a b:name.
I would like to pick this b:name and then assign it to local variable to use later in the section.
I have implemented and it seem to be right every thing. But it is not picking up the b:name.
Please could you see where I am going wronge.
many thank
<?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">
.odd1 { background-color: #ffcc11; }
.even1 { background-color: #ffffcc; }
</style>
Here goes overview data ...........
<div id="pkgPkgListA">
<s:behavior b:name="setstyle-example">
<s:event b:on="select">
<s:with b:target="../..">
<s:setstyle b:background-color="#7C90CD" />
</s:with>
<s:with b:target="../../td">
<s:setstyle b:color="#FFFFFF" />
</s:with>
</s:event>
<s:event b:on="deselect">
<s:with b:target="../..">
<s:setstyle b:background-color="#FFFFFF" />
</s:with>
<s:with b:target="../../td">
<s:setstyle b:color="#000000" />
Try to capture varaible here ==v
<s:variable b:name="rowClass" b:select="./@b:name" />
<s:task b:action="alert" b:value="{$rowClass}" />
<s:choose>
<s:when b:test="@b:name = 'odd1'">
<s:task b:action="alert" b:value="Loop 1" />
<s:setstyle b:background-color="#ffcc11" />
</s:when>
<s:otherwise>
<s:task b:action="alert" b:value="Loop 2" />
<s:setstyle b:background-color="#ffffcc" />
</s:otherwise>
</s:choose>
</s:with>
</s:event>
</s:behavior>
<b:spacer b:width="0px" b:height="5px" />
<table>
<thead>
<tr>
<th></th>
<th style="width: 100px, background-color:FFccFc;">Col A</th>
<th style="width: 160px;">Col B</th>
</tr>
</thead>
<tbody>
<c:forEach var="pkgPkgListA" items="${pkgPkgListA}" varStatus="rowCounter">
<c:choose>
<c:when test="${rowCounter.count % 2 == 0}">
<c:set var="rowStyle" scope="page" value="odd1"/>
</c:when>
<c:otherwise>
<c:set var="rowStyle" scope="page" value="even1"/>
</c:otherwise>
</c:choose>
<tr class="${rowStyle}">
<td><input b:behavior="setstyle-example" b:name="${rowStyle}" type="checkbox" /></td> <== My variaible define here
<td><c:out value="${pkgPkgListA.attribute1}"/></td>
<td><c:out value="${pkgPkgListA.attribute2}"/></td>
</tr>
</c:forEach>
</tbody>
</table>
</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">
.odd1 { background-color: #ffcc11; }
.even1 { background-color: #ffffcc; }
</style>
Here goes overview data ...........
<div id="pkgPkgListA">
<s:behavior b:name="setstyle-example">
<s:event b:on="select">
<s:with b:target="../..">
<s:setstyle b:background-color="#7C90CD" />
</s:with>
<s:with b:target="../../td">
<s:setstyle b:color="#FFFFFF" />
</s:with>
</s:event>
<s:event b:on="deselect">
<s:with b:target="../..">
<s:setstyle b:background-color="#FFFFFF" />
</s:with>
<s:with b:target="../../td">
<s:setstyle b:color="#000000" />
Try to capture varaible here ==v
<s:variable b:name="rowClass" b:select="./@b:name" />
<s:task b:action="alert" b:value="{$rowClass}" />
<s:choose>
<s:when b:test="@b:name = 'odd1'">
<s:task b:action="alert" b:value="Loop 1" />
<s:setstyle b:background-color="#ffcc11" />
</s:when>
<s:otherwise>
<s:task b:action="alert" b:value="Loop 2" />
<s:setstyle b:background-color="#ffffcc" />
</s:otherwise>
</s:choose>
</s:with>
</s:event>
</s:behavior>
<b:spacer b:width="0px" b:height="5px" />
<table>
<thead>
<tr>
<th></th>
<th style="width: 100px, background-color:FFccFc;">Col A</th>
<th style="width: 160px;">Col B</th>
</tr>
</thead>
<tbody>
<c:forEach var="pkgPkgListA" items="${pkgPkgListA}" varStatus="rowCounter">
<c:choose>
<c:when test="${rowCounter.count % 2 == 0}">
<c:set var="rowStyle" scope="page" value="odd1"/>
</c:when>
<c:otherwise>
<c:set var="rowStyle" scope="page" value="even1"/>
</c:otherwise>
</c:choose>
<tr class="${rowStyle}">
<td><input b:behavior="setstyle-example" b:name="${rowStyle}" type="checkbox" /></td> <== My variaible define here
<td><c:out value="${pkgPkgListA.attribute1}"/></td>
<td><c:out value="${pkgPkgListA.attribute2}"/></td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
