One way to do it would be to create a hidden field in your JSP named something like "selectedId". You would then write a JavaScript function fired by the onclick event of each <tr> element in the table that would apply a different CSS style to the row and use the DOM to get some value displayed in the current row and set selectedId to that value.