java - Nested JSTL variable name? is it possible? -


i trying use jstl variable inside variable. code below explain better.

 <display:table id="resultsrow" name="${actionbean.list}" >                                                                  <c:foreach items="${actionbean.anotherlist}" var="columnname">            <display:column sortable="true" property="${resultsrow.${columnname}"/>         </c:foreach>   </display:table> 

so passing list display table tag "name="${actionbean.list}". use id property of display table tag loop through list objects (id="resultsrow").

now column property attribute need access different properties inside list object. being done using for:each provides me object property names. if wondering why implemented instead of column, because using dynabean object , properties dynamic.

question: can used nested vairable names did in display column tag property attribute?

i need to: 1) evaluate columnname , value ( lets "price" string) 2) concatenate value our variable (${resultsrow.price}) 3) execute ${resultsrow.price}

as mentioned in this answer, should able use bracket notation access 'dynamic' properties so:

<display:table id="resultsrow" name="${actionbean.list}">                                                              <c:foreach items="${actionbean.anotherlist}" var="columnname">        <display:column sortable="true" property="${resultsrow[columnname]}"/>     </c:foreach>  </display:table> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -