I have an address page where I want to be able to populate the city field when a user enters a zipcode. what is the best way to do this. Keep in mind that I have to query a db when I get the zipcode to retrieve the city
How about having your JSP page submit to a servlet when a "Verify Zip Code" button is pressed? The servlet could then use JDBC, or a similar technology, to look up the zip code in the database. If found, it would store the corresponding city in the session context and forward the request to your JSP. Your JSP would then serve the page with the City field filled in.
Co-Author of <a href="http://www.oreilly.com/catalog/jswing2" target="_blank" rel="nofollow">Java Swing</a><br />Co-Creator of <a href="http://www.sun.com/training/catalog/courses/CX-310-055.xml" target="_blank" rel="nofollow">SCJP 5.0</a> and <a href="http://www.sun.com/training/certification/java/associate_beta.xml" target="_blank" rel="nofollow">SCJA</a> exams
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database