| Author |
how to load the values in one object?
|
maggie joseph
Ranch Hand
Joined: Dec 29, 2009
Posts: 185
|
|
when i print for size of table ..i get correct values i.e.4..
but when i want the actual values from the table and i ask System.out.println(b1);
it prints some values like [myServlets.Data@451c0d60, myServlets.Data@34b23d12, myServlets.Data@21c783c5, myServlets.Data@319c0bd6]
i want actual values..
this is silly and it will require a simple java statement,but i don know how to access that..
there is no problem with sql ,no problem with post or get method definition....
Thanks.....
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
This is simple Java -- that's what's returned from the default toString() of the base Object class. If you want to extract and emit the value for the List, you'll need to iterate over the list.
I have moved this to a more appropriate forum.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Sridhar Santhanakrishnan
Ranch Hand
Joined: Mar 20, 2007
Posts: 317
|
|
|
You can override the toString() method in your Data class.
|
 |
maggie joseph
Ranch Hand
Joined: Dec 29, 2009
Posts: 185
|
|
|
the toString method is not working there...i tried doing it....
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
You can't override toString for arrays, but you can use the toString methods of java.util.Arrays for that.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Sridhar Santhanakrishnan
Ranch Hand
Joined: Mar 20, 2007
Posts: 317
|
|
|
Overriding the toString() method in Data and then calling <yourList>.toString() should list all objects.
|
 |
maggie joseph
Ranch Hand
Joined: Dec 29, 2009
Posts: 185
|
|
it is not happening with toStriing method too....
it is giving me an error as not recognising the method toString.....
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Then it's not an object. Every object, even arrays, has a toString() method.
|
 |
Afzal Rehman
Ranch Hand
Joined: Dec 16, 2009
Posts: 35
|
|
what ever is your data class you should have to override the toString method and gives the appropriate values.
Whatever you expect. toString method will give understandable representation of object.
|
SCJP 6.0
|
 |
 |
|
|
subject: how to load the values in one object?
|
|
|