In DB access where to write the query. In JSP or servlet?
We can write query in both JSP page and servlet. It depends upon you. But it is better to separate classes to make a database connection, pass the reference to the JSP page and write query using JSTL 2.0(Java Standard Tag Library).