Standard responses
1 - Don't use scriptlet code in JSP.
Java code belongs in servlets/beans.
2 - The JDBC-ODBC bridge driver is
![](https://coderanch.com/images/smilies/e78feac27fa924c4d0ad6cf5819f3554.gif)
. I suggest getting a real database, with a supported
JDBC driver (MySQL, Oracle, MSSql...)
3 - When constructing sql statements with strings, you leave yourself open to sql injection attack. Instead your sql should use prepared statements to pass in the users values.
Specific to this code.
- You need to match up the names of your controls with the request parameters you are looking for.
For instance you have:
CABINET/EXCHANGE/TER <> Cabinet
The control "name" and the request parameter being retrieved must match.
I would suggest renaming the input components on AutoAssign.jsp to match what you have in the getParameter() calls in retrieve.jsp.
Suggested debugging steps
- print out the values of the search fields on your results page so that you can see they came through correctly.
- print out the sql generated to execute. Try running it on your database, and see what you get. Fiddle with it until you get sql that works, and then try translating the changes back to your code.
Things to think about
- are all your search parameters necessarily used to run the query? Particularly the remarks column will restrict the results too much I would think.
- consider writing the query logic into a java class. This code sample is based on
patterns from 10 years ago. We've come a long way since then.