This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSP and the fly likes Inserting table in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Inserting table in JSP" Watch "Inserting table in JSP" New topic

Inserting table in JSP

Kyupa Supa
Ranch Hand

Joined: Jun 23, 2012
Posts: 30

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;)
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6337

Searching for "jsp jstl iterate over list" will get you some useful links.

Junilu - [How to Ask Questions] [How to Answer Questions]
I agree. Here's the link:
subject: Inserting table in JSP
It's not a secret anymore!