aspose file tools*
The moose likes Servlets and the fly likes Proper mix of Servlets and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Proper mix of Servlets and JSP" Watch "Proper mix of Servlets and JSP" New topic
Author

Proper mix of Servlets and JSP

Kenny Dilger
Greenhorn

Joined: Jan 14, 2002
Posts: 11
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
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
David Peterson
author
Ranch Hand

Joined: Oct 14, 2001
Posts: 154
Good response.
David
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Proper mix of Servlets and JSP
 
Similar Threads
Value in dropdown from servlet
What's faster than JSP?
pass data from JSP-JSP-SERVLET-DATABASE
JSP calls Servlet calls JSP
JSP to Access 2000 database