You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rahul Akolkar <ra...@gmail.com> on 2005/11/01 01:49:34 UTC

Re: Expression in an expression?

Otmar - Please see reply below.

On 10/31/05, Michael Rasmussen <ra...@gmail.com> wrote:
> You could try putting all of your collections into a collection and
> accessing them by the index that way, or you could use a:
>
> <c:choose> style approach combined with your current tag and use index
> in a series of <c:when test="${index eq 1}">
> <c:set var="myColelction" value="${myCollection1}"/>
> </c:when>
> </c:choose>
>
> Unfortunately expressions within expressions will not work and
> wouldn't be really clean if you actually did find a way to do it.
>
> On 10/31/05, Otmar Manuela <ot...@caribmedia.com> wrote:
> > Hi,
> >
> > Can someone help me with the following?  I have the following code in my
> > jsp file:
> >
> > <bean:size id="myId" collection="${myCollection1.myProperty}"/>
> >
> > The problem is that I have a number of collections and I want to be able
> > to dynamically tell the bean which collection to use.  The code below
> > does not work, but it will give you an idea of what I'm trying to
> > accomplish:
> >
> > <bean:size id="myId" collection="${myCollection${index}.myProperty}"/>
> >
> > Is there a way to accomplish this?
<snip/>

You cannot gensym in JSP or EL.

Michael has one solution above, I'd move that bit to a delegating bean
that accesses the appropriate collection so the view stays fairly
clean.

-Rahul


> >
> > Thanks,
> >
> > Otmar Manuela
> >

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