Hi All,
I need to return the following to my
JSP page:
A list of results from a single table (to use in a select box)
A single result from the same table to display for editing.
In this scenario, the list I return will always contain the single result I wish to display. My question is, which is the most efficient way to get the single result. I see 3 alternatives:
1) Place the key for the single result in a response, Then iterate through the list at the JSP page until I find the desired single result.
2) go to the database twice, once to generate the list from a db access, then a 2nd db access to get the single result.
3) When processing the returned result set, pull out the desired single result and place it in a seperate bean to return to the page.
I think option 1 is the best, as 2 has 2 expensive DB accesses in it, and 3 would seem to make the class file processing the result very specific. Does this sound reasonable, or is there a better way altogether?