Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to retrieve list data from webservice into jsp page?

 
Sarah Choudhary
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I am calling a web service function in jsp client application. This function is returning a list (Retrieved from database). My question is how can I modify my code so that all the values in the list can be displayed in jsp (Client application)?


I am using netbeans IDE 7.2.


Actually, I have to tried the following code (jsp) but it only displays the last value in the list while testing the web service in netbeans gives all the values of list.




web service code


 
Saket Kumar Sinha
Ranch Hand
Posts: 32
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are returning ArrayList



This would print all the data. for proper formatting you can use table tag. and can put the result in tr and td.
 
Sarah Choudhary
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but it gives an error of incompatible type i.e. ArrayList required, string is found



When I test the web service (above mentioned code) using netbeans IDE, it returns the list values but when I try to get these values through client application, only the last value of the list is returned.





Saket Kumar Sinha wrote:Since you are returning ArrayList



This would print all the data. for proper formatting you can use table tag. and can put the result in tr and td.
 
Sarah Choudhary
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody tell me, why the client app. is getting a string value? It should get list data instead of a single string value as web service is returning list data while testing.

One more thing; While debugging, I have noticed that the class generated by jax-ws RI has changed the return value of getFeedback() to string. Why is it so?? I have checked .java file, it's still returning the list data.

In short, the problem is while testing web service, it gives the expected list data while invoking service through client gives an error of incompatible type.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It makes no sense to return an object implementing List - instead return an array, a standard data type in SOAP and RPC.

Bill

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic