• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ArrayList in http response.

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to pass ArrayList(from servlet) in HttpResponse(To JSP)(Ajax).

arraylist contains the list of POJO instances..

can anybody help me out ???
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The call back is plain string.

Question for you is what would you normally do to display this information on a normal page? Probably loop through the info some how?

Well you need to loop through the data and make it in some readable format that you can use on the client. Either you make some sort of string format that can be parsed, or you look into JSON.

Eric
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okis gotcha... thanks...
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now i have looped in my servlet and created a responseText like the bellow

res = "<option>xxxx</option><option>yyyy</option><option>xxxx</option>";


<script>
....
....
....
var res = responseText; //res = "<option>xxxx</option><option>yyyy</option><option>xxxx</option>";
....
....
....
....
<script>



Now that i have got the html String but how will i display the response in my html body part ???
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic