869Chapter 45A User-Rating SystemThe aggregated page is pretty (My web site)
869Chapter 45A User-Rating SystemThe aggregated page is pretty much just a sorted and aggregated view of the underlying ratings table, with some tricks to make the display more concise. (We round the averaged rat- ings to a reasonable precision and truncate the quotes at the first sign of punctuation.) Theaggregation happens as a result of grouping the ratings rows (of which there are many perquotation) by quotation in the SQL statement and averaging the ranks. We also turn the trun- cated quotations into links back to the display pages, using the ID of the content as a GETargument. (Note that although this is a top-ten list, there are only eight quotations in our sample dataset.) Figure 45-3:A top-ten view of the rated quotationsThe analysis this page provides is a direct product of the SQL statement it displays. Ratherthan displaying the most highly rated items, it would be easy to display the most poorlyrated, or the items with the most ratings overall, or any number of other analyses, simply byvarying the SQL statement and the title. What about performance? We don t have any hard data, but you can look at www.mysteryguide.com/readerratings.html, which uses roughly these techniques, and see how suchapage performs with three best of analyses on approximately 30,000 individual ratings. Asyou may be able to tell, it s just beginning to slow up perceptibly, taking a second or two torespond under typical conditions on our Web host. Extensions and AlternativesWe have tried to make this example as bare bones as possible, focusing on the ratings codewhile also retaining the minimum functionality to make a functioning mini-site. There are sev- eral ways in which you could improve or extend the code if you feel so moved.
Check Tomcat Web Hosting services for best quality webspace to host your web application.