473,326 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Can you use c:forEach loop to display output of multiple arrays?

24
Hi,
I have been learning JSP and Servlets when I came upon JSTL and EL concepts.. I am new to JSP...
From what I understand JSTL and EL was introduced in JSP so as to avoid using scriplets
Expand|Select|Wrap|Line Numbers
  1. <%%>
in JSP because it clutters everything(business logic as well as presentation logic) in a JSP,which was originally designed for presentation purposes...

But the prefix:forEach loop has me confused...I have tried using it to display arrays,lists,string,arraylists,vectors,etc... for practice and noticed that I have to use
Expand|Select|Wrap|Line Numbers
  1. <prefix:forEach>//Display here//${data}</prefix:forEach>
for every new array,string...
So if I have 10 different arraylists..I will have to use 10 forEach loops...It kind of makes the page too long and lot of efforts...If I use scriplets
Expand|Select|Wrap|Line Numbers
  1. <%%>
I can use a normal for loop and use the
Expand|Select|Wrap|Line Numbers
  1. name.get(variable of for loop);
and get data of all 10 arraylists...

Or is there a way to make prefix:forEach to behave like a normal for loop and get all 10 arraylists's data using single forEach??
Jun 6 '13 #1
1 1839
r035198x
13,262 8TB
Use object oriented design with POJOs rather than having ten array lists. Then you only have one ArrayList<YourPOJOClass>.
Jun 11 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: raj | last post by:
Hey all I have a base class that manages (Manager_class) different shapes. It has different arrays of Circle_class, Square_class and etc etc. All the shapes have a common base class...
1
by: jose luis fernandez diaz | last post by:
Hi, In the chapter 4 'Collections and Records' of the 'PL/SQL User's Guide and Reference Release 8.1.6' book there is the next paragrap: "For example, PL/SQL supports implicit (automatic)...
0
by: Drydo | last post by:
In short, is it possible to swap/change the display output of a laptop to a CRT programmatically? The scenario is that we have a laptop that at the startup of a specific application would...
27
by: jacob navia | last post by:
Has anyone here any information about how arrays can be formatted with printf? I mean something besides the usual formatting of each element in a loop. I remember that Trio printf had some...
3
by: cs_hart | last post by:
I have the following data custID orderNum trackingNum ShipDate I have put these in multiple arrays since I want to redim. For example, the user selects one shipdate and I keep only the entries...
1
by: jpoloney | last post by:
I was wondering if there was a quick and easy way to sort multiple arrays in C++. What I mean is that, say I have 3 integer arrays. They are in order by array indices (array1 corresponds to array2...
1
by: tigerved | last post by:
Hi I am new to this so I dont exactly know the format in which to post the questions ....anyways here goes ...my file looks like this Year,Day,MOnth,latitude,longitude (commas included)...
0
by: zizi2 | last post by:
Hi, how do I output multiple excel files from one source using vbscript? Regards, Noluthando
5
by: darkestknight43 | last post by:
Hello, I've been working on this piece of code for quite a while. Essentially it is a Search Tool which pulls Mobile Home information from a database and displays listings based on the users input....
2
by: Ravi More | last post by:
Hello, I want to get comment element from three arrays. Please Help me. Thanks in advance! # To retrieve common elements from three array #!/usr/bin/perl use strict; use warnings;
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.