You need to separate the presentation from business logic.. Here is a simple how
You need a servlet (say DisplayController.java)
You need a JSP (MyView.jsp)
Then..through your web browser.. you should call the servlet (assuming you have configured the servlet in web.xml)
In the servlet, you will retrieve the contents from database and put the contents in a list or map or any data structure of your choice. Then you need to get that variable ready to be accessible by UI. That means you should send the variable by adding it at as an attribute to the request.
Then pass on the view to JSP. You can do that by using the RequestDispatcher
In JSP you should use your scriptlets/JSTL to just iterate over the results variable that is retreived from attributes which is a list or or map and display them
Hope its clear.. Can ask if its not!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: how to connect to database and display query vqlus using proper java/jsp