You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pu...@Dell.com on 2005/06/02 17:22:32 UTC

FW: Expression evaluation with html-el tags?

 


 
Is it possible to do more than just simple loop index evaluation with
html-el tags?

I iterate over 2 loops:

<c:forEach var="outerMapEntry" items="${outerMap}"
varStatus="outerLoop">
   <tr><td><c:out value="${outerMapEntry.key}"/></td>
   <c:forEach var="innerMapEntry" items="${outerMapEntry.value}"
varStatus="innerLoop">
      <td><html-el:text
property="myIndexedProperty[${innerLoop.index}]"/></td>   
   </c:forEach>
   </tr>
</c:forEach>

However, within my inner loop, I want to calculate the index as follows:

outerLoop.Index * innerLoop.size + innerLoop.index

My questions are:

1) The following works for me, 

<td><html-el:text
property="myIndexedProperty[${innerLoop.index}]"/></td>,

But if I try to do any calculations like so, 

      <td><html-el:text property="myIndexedProperty[${outerLoop.index} *
${innerLoop.index}]"/></td>   

I get errors, saying that there is no such getter defined. 


2) Surely, it should be possible to use html-el to access map entries
directly? The form I have has a Map of Maps. I need to access the inner
map values, put them in a table, allow editing / submission of those
values. It seems to be excessively convoluted to put the map values in
an arraylist, just so I can access them using indexed properties. 

Thanks, 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Expression evaluation with html-el tags?

Posted by John Fitzpatrick <jo...@vitarara.net>.
I've never had a need to do anything like what you're doing, but I can tell
you that ${} needs to contain the entire expression. Try this:

<html-el:text property="myIndexedProperty[${outerLoop.index *
innerLoop.index}]"/></td>





On 20050602 11:22 AM, "Pushkala_Iyer@Dell.com" <Pu...@Dell.com>
wrote:

> 
> 
> 
> 
> Is it possible to do more than just simple loop index evaluation with
> html-el tags?
> 
> I iterate over 2 loops:
> 
> <c:forEach var="outerMapEntry" items="${outerMap}"
> varStatus="outerLoop">
>  <tr><td><c:out value="${outerMapEntry.key}"/></td>
>  <c:forEach var="innerMapEntry" items="${outerMapEntry.value}"
> varStatus="innerLoop">
>     <td><html-el:text
> property="myIndexedProperty[${innerLoop.index}]"/></td>
>  </c:forEach>
>  </tr>
> </c:forEach>
> 
> However, within my inner loop, I want to calculate the index as follows:
> 
> outerLoop.Index * innerLoop.size + innerLoop.index
> 
> My questions are:
> 
> 1) The following works for me,
> 
> <td><html-el:text
> property="myIndexedProperty[${innerLoop.index}]"/></td>,
> 
> But if I try to do any calculations like so,
> 
>     <td><html-el:text property="myIndexedProperty[${outerLoop.index} *
> ${innerLoop.index}]"/></td>
> 
> I get errors, saying that there is no such getter defined.
> 
> 
> 2) Surely, it should be possible to use html-el to access map entries
> directly? The form I have has a Map of Maps. I need to access the inner
> map values, put them in a table, allow editing / submission of those
> values. It seems to be excessively convoluted to put the map values in
> an arraylist, just so I can access them using indexed properties.
> 
> Thanks, 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org