Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Populate a Table from ResultSet  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1739
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class that makes a remote connection and gets a result set. How can I display the ResultSet in a table on my JSP and make the contents of each row populate other text boxes on the form?
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Develop a custom tag that iterates over the ResultSet and generates an HTML table accordingly ...

Best of luck ...
 
Steve Dyke
Ranch Hand
Posts: 1739
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the table being populated now, thanks. Can you tell me how to place color on a row if a feild on that row meets a certain condition?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Passing a DB resource such as resultset, which retains connections to DB resources, to the UI layer and a JSP is severely frowned upon. Not only is just poor architecturally, but holding onto DB resources should span the smallest amount of time possible. You should copy your data out of the resultset while it is still in the data layer, and pass the copied data to the UI layer.

With regards to your question on color, that's a completely different issue and should be asked in a new topic.
[ September 18, 2007: Message edited by: Bear Bibeault ]
 
Steve Dyke
Ranch Hand
Posts: 1739
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I stated that I was using a ResultSet I did not mean I was using it directly in the JSP. I store the ResultSet in a array and use the array to populate the table.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cam you describe what the text boxes are and what kind of data is in the table?

I'm not sure what you mean but one type of page I can picture is a form with 4 or 5 fields and a table. The columns in the table match the text fields. Each row has an edit button that, when clicked, fills in the form with the data from that row.

Is this what you mean?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Dyke:
When I stated that I was using a ResultSet I did not mean I was using it directly in the JSP. I store the ResultSet in a array and use the array to populate the table.
Excellent!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!