Wednesday, 28 August 2013

jsp- when button is clicked, display search results, otherwise display everything in table

jsp- when button is clicked, display search results, otherwise display
everything in table

I'm trying to code a function to display search results when criteria is
entered into the input field and the search button is clicked. but before
someone searches for a particular field, everything from the table will be
displayed using the query "SELECT * from Quotes;".
Both input fields and search results table will be displayed on the same
table. I can get it to work on separate JSP pages, but using a function
would be better coding, as i have to this with a few other JSP pages, and
i dont want to have more JSP pages if i dont need them. so i was thinkin,
something like this.
<td><c:choose>
<c:when button.id=button1 is pressed display}">
<td><c:out value="${row.BookTitle}" /></td>
<td><c:out value="${row.Author}" /></td>
<td><c:out value="${row.Year}" /></td>
</c:when>
<c:otherwise>
SELECT * from Quotes;
</c:otherwise>
</c:choose></td>
Any help would be much appreciate.Thanks in advance.

No comments:

Post a Comment