2

i have created a model class to connect with database with a function that retrives a table data.now this function should return whole resultset back to a Controller action page. further controller action should send the data to jsp page for client viewing.

or simply how to hold Resultset data from query like..select * from table

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
condinya
  • 950
  • 4
  • 12
  • 19
  • Related: http://stackoverflow.com/questions/1831053/displaying-multiple-records-by-using-resultset/1832524#1832524 – BalusC Jun 16 '10 at 16:58

1 Answers1

1

In Model class you can convert your ResultSet into List which subsequently returned to view.The only code you need to write is converting ResultSet into List of Object

Vinay Lodha
  • 2,185
  • 20
  • 29
  • i used ArrayList.i got class cast exception:ResultSet cannot be cast to ArrayList – condinya Jun 16 '10 at 14:23
  • 1
    Yeah ResultSet can't be converted into ArrayList. You need to iterate over ResultSet and insert each object from ResultSet into ArrayList – Vinay Lodha Jun 16 '10 at 14:30