473,378 Members | 1,122 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,378 software developers and data experts.

Receiving an ArrayList parameter from a method

sunsolaris2000
Hi!

I need to insert in a html table (in JSP file) all the students in the same year. I tried 2 methods by now:

(1) In a java file I have a method(getStudents()) that searches in an ArrayList and find all students that are in the same year. This method returns the "results "ArrayList.

I need this ArrayList in JSP file. I tried to create a new ArrayList in JSP, called "found_students", but I don't know how to insert in it the students I receive from getStudents(). This list I need to insert in a html table.

(2) In java file, method getStudent() returns a Student object. In JSP I store the student in "search", which is of type Student. I used a do{}while(); but it found only the first occurence, not all the students in the list.

I'm new to JSP and I need this for school project. Any ideas/links? I searched Google, but I really didn't know how to search for "store the ArrayList received by calling a method in JSP in an ArrayList from java file".

Thank you in advance;)
Jul 1 '12 #1
1 2432
I solved it. The problem was the way I tested if array lists are containing elements and are not empty. I didn't say "!= false", but "!=0". But that's the way I found on web :p
Jul 14 '12 #2

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

Similar topics

3
by: b83503104 | last post by:
Hi, when I use .get() to read out my ArrayList, I always get the last element. Below is part of my code: for (int index = 0; index < my_list.size(); index++) { point2D test_point;...
2
by: Alex | last post by:
The following simplified code reproduces my problem: #include <iostream> struct MyTypeHolder { typedef int MyType; }; struct MyOp
6
by: Dan V. | last post by:
I would like to create a 2D string list (2D ArrayList ???). I would like to pass in a table or query as a parameter and have both columns transform into a 2D ArrayList. When I sort the one...
5
by: Zeng | last post by:
Hello Everyone, Is there anything wrong with this block of code? ArrayList arr = new ArrayList( 33 ); for( int i = 0; i < 33; ++i ) { arr.Insert( i, new MyObject() ); }
1
by: sd | last post by:
QUESTION: How can my ASP page - which uses language="VBScript" - pass a "System.Collections.ArrayList" object - as a parameter - to a C# method in the middle-tier ??? ----- Is it possible at...
3
by: Dean Slindee | last post by:
I have loaded two forms into an ArrayList with the following statement: arrForm.Add(Me) 'in each form's Load method. Now I want to reference a form in the ArrayList. However, I must not be...
12
by: Rubbrecht Philippe | last post by:
Hi there, According to documentation I read the ArrayList.IndexOf method uses the Object.Equals method to loop through the items in its list and locate the first index of an item that returns...
8
by: GrandpaB | last post by:
I need to sort an Arraylist. The Arraylist is contained in classArt. The Arraylist contains objects that have been defined in a sperate class, objArt. I have attempted to implement the sort using...
7
by: Paulers | last post by:
Hello I have an ArrayList full of Person objects. I would like to sort the object array by the objects property 'Name' so when I loop through it and populate a combobox they are in order. How do I...
7
by: heavyone | last post by:
I am trying to write a removeFirst method for an ArrayList of the generic type. The removeFirst method is supposed to do a few things: 1) If the list is empty it throws an error. 2) It stores the...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.