Bookmark Topic Watch Topic
  • New Topic

unable to retrieve values  RSS feed

 
sahana mithra
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have some ids in a method. But when I try to retrieve it from another method, I get only the last value. Here is my code.



[img]Output:
Ids of specific group MS109.89
Ids of specific group MS109.90
Ids of specific group MS109.91
[/img]

I want to retrieve the values in the below method




Please help me to get all the values
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
It's a bit hard to tell what the problem is, since we don't know what ar is (which you are using in line 12 of the first code snippet and line 2 of the second code snippet).

In line 12 of the first code snippet, you are setting some string in ar. In line 2 of the second snippet, you are getting that value out again. Are you sure you are setting the right thing in the first part?

Note that you have a while loop in the first snippet. By doing setMids (line 12) you are probably only storing the current value of MIds into ar. What was there before (from the previous iteration of the loop) is overwritten. So you only see the last value that you put in.
 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
what is "ar"?
 
Campbell Ritchie
Marshal
Posts: 55761
163
  • Mark post as helpful
  • send pies
  • Report post to moderator
Since nobody can understand your question, let's continue on your other thread.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!