You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by struts <st...@conissaunce.com> on 2008/02/25 18:12:52 UTC

Hi,

I'm using Struts 1

I have  a set of indexed error properties :

myProprty0
myPorperty1
myProperty2

and so on

I'd like to be able to pass the relevant name in to <html:errors property
via a variable – for example:

<c:set var="total" value="${0}"/

iterate...

<c:set var="myErrProp" value="$myProprty{total}" />

<html:errors property="<c:out value="${myErrProp" /><br/>

<c:set var="total" value="${total + 1}"/>

</iterate>

Is there a way to do this?

Thanks in advance,

Charles

Re: Posted by Laurie Harper <la...@holoweb.net>.
Antonio Petrelli wrote:
> 2008/2/25, struts <st...@conissaunce.com>:
>>  myProprty0
>>  myPorperty1
>>  myProperty2
>> ...
>>  Is there a way to do this?
> 
> Mmm.. let me see:
> <c:forEach var="index" begin="0" end="5">
>   <html:errors property="myProperty${index}" />
> </c:forEach>

Oh, well that's a lot simpler than what I was thinking if it works :-)

L.


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


Re: Posted by Antonio Petrelli <an...@gmail.com>.
2008/2/25, struts <st...@conissaunce.com>:
>  myProprty0
>  myPorperty1
>  myProperty2
> ...
>  Is there a way to do this?

Mmm.. let me see:
<c:forEach var="index" begin="0" end="5">
  <html:errors property="myProperty${index}" />
</c:forEach>

HTH
Antonio

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


Re: Posted by Laurie Harper <la...@holoweb.net>.
struts wrote:
> Hi,
> 
> I'm using Struts 1
> 
> I have  a set of indexed error properties :
> 
> myProprty0
> myPorperty1
> myProperty2
> 
> and so on
> 
> I'd like to be able to pass the relevant name in to <html:errors property
> via a variable – for example:
> 
> <c:set var="total" value="${0}"/
> <iterate...>
> <c:set var="myErrProp" value="$myProprty{total}" />
> <html:errors property="<c:out value="${myErrProp" /><br/>
> <c:set var="total" value="${total + 1}"/>
> </iterate>
> 
> Is there a way to do this?

Not really; it *might* be possible to do some funky EL manipulation like:

   <c:set var="prop" value="myProperty${total}" />
   <html:errors property="${myform[prop]}" />

although it may take a bit of fiddling to find the right combination of 
syntax. But really, you'd be better off using an array or list -- i.e. a 
'real' indexed property, instead of pseudo-indexed properties using a 
naming convention.

L.


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