Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

List pointer value is getting printed instead of data  RSS feed

 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've the below DAO File.



And the below Servlet



Here i'm trying to print the first value (caseNumber) in a jsp textbox using the below code.



But the output i getting is as below



but instead of this i need the exact value at there. please let me know where am i going wrong and how do i fix it.

Thanks,
Sunny
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you meant to display just the first item or all the records in the list?

If the latter, better to use the <c:foreach> to loop through the list.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why use toString() rather than a getter (accessor) that gives you the value that you want?
 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K. Tsang wrote:Are you meant to display just the first item or all the records in the list?

If the latter, better to use the <c:foreach> to loop through the list.


Hi Tsang, I don't want to retrieve all the values, i want only the first value to be retrieved.
 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why use toString() rather than a getter (accessor) that gives you the value that you want?


Hi Bear,

Thanks for this tip. I did it (using below) and got the result as expected.



Thanks Again
:beerchug:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!