corduroy9
asked on
Create array
In JSP I'm trying to create an array. I've been trying to use <c:set var='items' value='stuff' />
like in a for loop and keeping setting var but i don't think thats working. How should i go about this?
like in a for loop and keeping setting var but i don't think thats working. How should i go about this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Please let us know in more depth on what do you want if all above solution do not answer your question. I think that manuel_m solution is good enough.
Regards
Dave
Please let us know in more depth on what do you want if all above solution do not answer your question. I think that manuel_m solution is good enough.
Regards
Dave
ASKER
Manuel's idea is what i'm looking for. Obviously tho I'm not going to want to have static indexes. I'm going to want this dynamic
So inside my jsp i'll have a for each loop
and then I would want something like
<c:setArray var="row" index=<%i%> value ="$item"/>
Is that the correct way to have index increment?
So inside my jsp i'll have a for each loop
and then I would want something like
<c:setArray var="row" index=<%i%> value ="$item"/>
Is that the correct way to have index increment?
ASKER
also setArray is not recognized... y not
I don't believe setArray exists in JSTL... (at least not in 1.1)
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html
it's not there...
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html
it's not there...
<c:setArray var="row" index="0" value="0"/>
<c:setArray var="row" index="1" value="1"/>
<c:setArray var="myArray" index="0" value="${row}"/>
<c:out value="${myArray[0]}"/>
<c:out value="${myArray[1]}"/>
greetz
manuel