Is there a "proper" way to mix Servlet and JSP pages together? The book I have "More Servlets and JavaServer Pages" says that JSP pages should mostly be concerned with formatting of data received by a servlet. So does this mean that the Servlet should take care of Data collecting (be it either a Database or some other source) and the JSP page should just take that data and display it. In my current project I am downloading email message information from an email server and storing the messages in a Vector. Then the JSP page just uses the data from the Vector instead of making its own connections. In the future I would also use the method for database information. One problem I see could be if the data you are collecting is really large, say from a large database table. Thanks for any info, Kenny
This is a good way to use JSP, and helps encourage a separation between the data model and the presentation. As for your worry about loading large database result sets. You are right to worry, but the solution is not some kludge to connect to the database direct from the JSP, but instead to spend a little time thinking about why you have large amounts of results, and how to reduce them. Web application users need precise, targetted information, and rarely have any use for mile-long screens full of stuff (imagine if this bulletin board were just one huge list of thousands and thousands of posts ). A query which returns so many results is usually due to a mistake or an inflexible query system. Study the users' needs more, find out how they would refine the query, and offer them that option.