Results 1 to 3 of 3
Thread: Loop through Array in JSP
- 04-23-2010, 09:19 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 27
- Rep Power
- 0
Loop through Array in JSP
Hi Guys,
Please Help, I had the same post before, but no one replied. please:
I've got a big problem with these JSP/JSPX pages. I'm sure you people can help me.
Basically I am passing an array of strings from a Java servlet to a JSP page where I am trying to go through the array using 'forEach' loop and for each element, invoke a MYSQL command.
The array is called "Websites".
Here is my code:
<c:forEach var="e" begin="0" step="1" end=${Websites.length}>
<sql:query var="table">
select SUM(usability) as number from ${Websites[e]};
</sql:query>
.......
I have two main problems, firstly in the ForEach Tag, "Website.length" is not working, it returns SQL error at run time.
secondly in the MySql command, "${Website[e]}" is not working too, it returns SQL error at run time as well.
PLease Please help because I have been spending so much time on this. :(:(:(
- 04-24-2010, 12:52 AM #2
I think Websites has to be a collection, e.g. ArrayList, not array ?
- 04-25-2010, 09:00 PM #3
Member
- Join Date
- Mar 2010
- Posts
- 26
- Rep Power
- 0
Similar Threads
-
Loop through an Array and invoke SQL command
By Robert_85 in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 04-25-2010, 12:14 PM -
Finding a the max value of the array using a for loop
By soccer_kid_6 in forum New To JavaReplies: 1Last Post: 04-11-2010, 11:25 PM -
How do I create an array with every cycle of a loop?
By blackhole8746 in forum New To JavaReplies: 3Last Post: 05-07-2008, 07:49 AM -
Need another program with and if-else, array, and for loop
By Zebra in forum New To JavaReplies: 2Last Post: 05-05-2008, 01:56 PM -
Timing array loop performance
By Java Tip in forum java.langReplies: 0Last Post: 04-14-2008, 08:43 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks