Nope. I do not have them in the array. I need to construct
variable name on the fly.

I could use <c:set> to build a variable name:

    <c:set var="variableName" value="name${index}"/>

but I wonder now if there exists a way how to get a value
of a variable with the name 'variableName'?

Taavi

> nevermind, don't think you can do it like that.  But it'll probably be
> easier if you put name1, name2, name3, etc into an array, or hash, or
> such, and do:
> 
> >  <c:forEach begin="1" end="4" var="index">
> >      <c:out value='${name[index]}'/>
> >  </c:forEach>
> >
> 
> nick
> On Thu, 3 Jul 2003, N. Chen wrote:
> 
> >
> >
> > well, actually yes.  Assuming name is an array or something similar:
> >
> >  <c:forEach begin="1" end="4" var="index">
> >      <c:out value='${name[index]}'/>
> >  </c:forEach>
> >
> > On Thu, 3 Jul 2003, Taavi Tiirik wrote:
> >
> > >
> > > Hi, I have variable names like name1, name2, name3, etc. in JSTL.
> > >
> > > Instead of hard coding the expressions like this ${name1}, ${name2}
> > > I would like to use them in a loop.
> > >
> > > The following syntax is not valid of course. Is there a way how to
> > > achieve this:
> > >
> > > <c:forEach begin="1" end="4" var="index">
> > >     <c:out value="${name${index}}"/>
> > > </c:forEach>
> > >
> > > thanks,
> > > Taavi


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to