Originally posted by Darren Edwards:
Shouldn't the servlet side of the code read
Originally posted by Stefan Evans:
You might try this:
This will dynamically construct the sql for you - ie the sql string for the query is dynamic, as opposed to using the same string with a prepared statement, and substituting in values.
If you don't have a JSP2 container, replace ${sort_order} with <c:out value="${sort_order}"/>
Cheers,
evnafets
Originally posted by Satou kurinosuke:
Is there actually an attribute called "sort_order" in your request ? It seems to be empty/null.
Kevinolo Lee wrote:Sorry to be resurrecting this thread after so many years; I think it's still relevant!
...
Anyway, to cut the long story short, this is my code for my project (book store):
<sql:query var="result" dataSource="jdbc/yourjdbcconnection">
SELECT * FROM book
ORDER BY
...
You can also avoid this problem if the sql query is done on a separate page once the user fills up a form and hits "submit" - i.e. you really ensure that no null values are passed into the sql query.
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|