JSP 2.0: The New Deal, Part 1
Subject:   Dynamically Build Expressions to Evaluate?
Date:   2005-06-01 05:22:19
From:   JavaJockey
Response to: Dynamically Build Expressions to Evaluate?

Dear All,

Can anyone answer this for me. I have a similiar problem. I am trying to access form bean properties, e.g. title1, title2 etc by dynamically linking the indexId 'ctr' to the title part. This is having no effect. For instance "report.title1" should return "company" on the screen, instead all I get is "report.title." I have enclosed my code fragment to illustrate. I have based it on various sources including the stuff in this thread, but without sucess. Please help if you can.


<table width="85%" border="0">
<c:set var="style" value="datalightsmall" scope="page" />
<logic:iterate id="record" property="report" name="reportSearchForm" indexId="ctr" scope ="request">

<!--c:set var="style" value="datalightsmall" scope="page" /-->
<c:when test= "${(ctr =='1')}">
<c:set var="value" value="${record.title${[ctr]}}"/>
<td class="viewcolumntitle" width="20%"> <c:out value="${value}" /></td></c:when>
<!-- Do nothing -->