I have below
1) StudentDAO.java -> has a method to list all students
2) ListStudentServlet.java -> Contorller to get the list and send to jsp
3) ListStudent.jsp -> Display Student List
Now I want to add condtions such as
studentId greater than, less than, equals, etc
StudentName like ‘%A%
StudentDOB between date1 and date2
what’s the best approach to get results based on above conditions. Do I need to creat separate methods for each of the condition or can i have one method with different where clauses?
Please can you an example?
thanks
You can supply different GET parameters to the servlet. For example:
?operator=greaterThan&column=studentId&value=5?operator=like&column=name&value=%AYou can also have these things coded in the servlet itself, and only submit one parameter that identifies the combination. For example, if you have a list of queries, you can have
?queryId=5