Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
|
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 30th, 2003, 12:39 PM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to psantos
Default Best way to bind config data to a web app

Hi,
  I'm building an application that uses some configuration
  data in database tables. My JSP's will use this data to
  populate drop-down lists, radio button etc.

  I'm trying to avoid making a database connection everytime a user
  visits a page with config data. My goal is to load all config data
  from the database when the application comes up (tomcat), then
  reference the config data through some method without having to
  make db calls (event w/conn pooling).

  What is the most efficient way of binding this
  configuration data to an application? and is this possible?

  I'd also like to have an "admin" page where an administrator can
  change the config, and have the changes show up on my drop-down
  lists immediately.

  I'd like to do it without bouncing a servlet/jsp container if
  possible.

  My goal is to bind the data to the "application context" so that
  it can be referenced without additional overhead in database calls.

  Any ideas would be appreciated.
  Peter
 
Old September 30th, 2003, 04:05 PM
Registered User
 
Join Date: Jul 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gopalvengadam
Default

Have a startup serlvet or jsp that loads when your tomcat comes up and do the logic of storing your configurations in a static hashmap or any data structure (make static object) that fits your needs..

you can specify start up servlets in web.xml.. You specify <load-on-startup>..You can easily find syntax and reference for this on the web.

-- gopal
 
Old October 21st, 2003, 06:36 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe use the web.xml file for the webapp. In here it is possible to setup environment variables (as xml). Why don't you use this, everytime the webapp is loaded

Quote:
quote:Originally posted by gopalvengadam
 Have a startup serlvet or jsp that loads when your tomcat comes up and do the logic of storing your configurations in a static hashmap or any data structure (make static object) that fits your needs..

you can specify start up servlets in web.xml.. You specify <load-on-startup>..You can easily find syntax and reference for this on the web.

-- gopal





Similar Threads
Thread Thread Starter Forum Replies Last Post
web.config vs. app.config darlo Visual Studio 2005 11 August 20th, 2008 07:23 AM
How to access app.config in C# ? cczhangjm XML 2 May 16th, 2007 07:43 PM
configure web.config (db details) when deploy app? benilpj ASP.NET 2.0 Basics 3 June 7th, 2006 09:27 PM
Chapter 8 - app.config jotto BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 2 March 21st, 2006 05:31 PM
persisting data in a web app badgolfer ASP.NET 1.0 and 1.1 Basics 3 October 20th, 2004 01:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.