spacer
Web Development Tutorials JAVA Tutorials
 Developer Newsletter

Tutorials
AJAX
ASP
CGI & Perl
CSS
Flash
HTML
Illustrator
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML
Miscellaneous


Scripts Directory
AJAX Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Web Hosting Directory
ASP.NET
Budget
Dedicated Servers
Ecommerce
Linux
Resellers
Shared
Small Business
Windows

Developer Manuals
Learn HTML
Learn PHP
Learn CSS
Learn AJAX
Learn JavaScript
Learn Pear
Free White Papers

Developer Resources
Developer Tools
Developer Content
Survey Software
Dedicated Servers




Load List Values for Improved Efficiency

By Srinivasa Rao Karanam
2005-06-22


How to load drop-down list values at application start-up time

Reduce the number of database hits and improve your Web application's efficiency when you load common shared list values only once. In this code-filled article, learn to load the values for drop-down lists when your Web application starts and then to share these loaded list values among all the users of your application.

If you load common shared list values only once, you can reduce the number of database hits and make your Web application more efficient. In this quick-and-easy, code-filled article, I explain how to load list values for the drop-down list at start-up time for your Web application. I also show you how to share these loaded list values among all users of the application.

You can choose from three different scenarios when your application loads a drop-down list of items:

  • Every time a page displays drop-down lists, it makes a hit to the database to load the drop-down lists. If your application sends 10 requests for five drop-down lists on a page, the number of database hits is 50 (10x5). The database hit count increases proportionally to the number of requests.
  • The application loads all drop-down list items at the start of the user session and uses them for the entire session. The drop-down list items are stored in the session. In a user session, the number of database hits is constant and the database hit count increases proportionally to the number of sessions.
  • Your application loads all drop-down list items at application start-up and uses them for all application users. The drop-down list items are stored in the application with static reference. The number of database hits is constant for the application.

In this article, I explain how to implement the third case I mention above -- loading all items when the application starts.

Before I jump into the implementation details, though, it is important for you to understand that drop-down list values display in the HTML <SELECT> tag. The <SELECT> tag creates the drop-down list like so: <SELECT attribute1="..." attribute2="...">< /SELECT>. The <OPTION> tags placed inside the opening and closing <SELECT> tag define the list items. The attributes for this are:

  • MULTIPLE specifies that the user can select multiple items.
  • NAME="..." specifies the name of the list (part of the NAME/VALUE pair).
  • SIZE="..." specifies how many items are visible.

The command <OPTION value="...">item specifies an item in the drop-down list and is placed within the opening and closing <SELECT> tags. Any text that follows the <OPTION> tag is what the user sees in the list. The attributes for this are:

  • VALUE="..." specifies the value that returns (part of the NAME/VALUE pair).
  • SELECTED is already highlighted when the page loads.


Tutorial Pages:
» How to load drop-down list values at application start-up time
» Implement listload at app start-up
» In conclusion
» Resources


First published by IBM DeveloperWorks


 | Bookmark Print |   Write For Us
Related Tutorials:
» All about JAXP, Part 1
» Make Database Queries Without the Database
» 2 Ways To Implement Session Tracking
» A Simple Way to Read an XML File in Java
» Develop Aspect-Oriented Java Applications with Eclipse and AJDT
» Java Validation With Dynamic Proxies



About the NetVisits, Inc Network | Write For Us | Advertise
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: