I'm currently maintaining a web application using:
- Java
- JSP/Servlets (ie. no frameworks)
- WebSphere
- DB2
It's basically a CRUD application that lets users view data and manipulate them. It's almost as if it's a replica of the DBMS, only on the web. The code is full of SQL statements everywhere -- in almost each of the servlets in the application.
Currently, my manager is asking me to implement some sort of filters for the data.
Let's say we have a table SomeTable
:
Col1 Col2 Col3 Col4 Col5
---- ---- ---- ---- ----
data2 data3 data4 data5 data6
In the application, if you go to the SomeTable
page, you get to see the exact same data from the SomeTable
table, with the one exception that they're displayed in an HTML table. Now, what my manager wants is for the user of the application to be able to filter the data from a different page (let's call this filter page) and then after applying the filters, go back to SomeTable
page and display the filtered data.
In the filter page, they'll be able to choose something like:
Col1 = data2
Col3 LIKE %some%
Col4 IN 1,2,3
These options are all from select boxes. We currently have a functionality like that in one of the pages but it's ugly. SQL statements being passed around session attributes and concatenated with each other on the end. Plus, I can't really re-use them without copying all the code.
Someone probably invented something to deal with this and I'm wondering if anyone can give me a advice on how to approach this problem. Is there a framework that I can use or would it be easier to do it just by hand since the application is not really that big.