Satya Prakash
Satya Prakash

Reputation: 3502

How to traverse Table data in Java and pass that to servlet for using in JSP

I am a PHP programmer and got to know that for me Object oriented-ness, Strict type, and missing powerful array from PHP can be a big problem in Java. I tried to get code related to above question but no one works.

My questions:

How to traverse table in various way?
Is there any good tutorial for me related to collection that can be helpful for PHP programmer. I learned Oracle tutorial but that has not solved my problem. That may require lots of attention! I need practical way to learn.
Is there any good method to know how object are structured inside? In PHP I can use print_r, var_dump and can see what is inside.

Here is more explanation asked by a commenter:

 try {  
   ArrayList Rows = new ArrayList();  

   while (resultSet.next()){  
   ArrayList row = new ArrayList();  
   for (int i = 1; i <= 7 ; i++){  
           row.add(resultSet.getString(i));  
   }  

   Rows.add(row);  
}  

Here, do I have a leisure to add complete rows at a time and use that in ArrayList? I do not want to use getString()/getInteger() etc on each column. Or in Java, I need to get every column data one by one.

Upvotes: 1

Views: 697

Answers (2)

ahvargas
ahvargas

Reputation: 902

In the past i use this library : jbeandumer it worked for me. Here is an introduction.

Upvotes: 1

Tony Ennis
Tony Ennis

Reputation: 12299

The standard Java release has no way to conveniently dump a collection. I would be surprised, however, if you couldn't find a non-standard class that does this.

That being said, if you run your code in an IDE and use the debugger you can get what you want pretty easily.

Upvotes: 1

Related Questions