| Author |
Dropdown Change HTML <select><option>
|
Lou Pellegrini
Ranch Hand
Joined: Nov 11, 2003
Posts: 105
|
|
Hi,
I hope this is the correct forum for this question.
My html <option> values may change frequently. Instead of reading the database every time they are needed, how can I hold them in a List to send when needed, and still be able to pick up changes without restarting the server?
Thanks,
Lou
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56199
|
|
Sure. Are you using a JSP to render your page?
If so store the List of options in application context where any JSP can access it, and change the List whenever you want.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Lou Pellegrini
Ranch Hand
Joined: Nov 11, 2003
Posts: 105
|
|
Thank you for your prompt reply Bear!
I still don't understand how I get a reference to the populated List object to make the changes when needed.
Thanks,
Lou
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56199
|
|
|
From a servlet, the app context is available via servletContext.getAttribute().
|
 |
Lou Pellegrini
Ranch Hand
Joined: Nov 11, 2003
Posts: 105
|
|
I think I see.
Use servletContext.getAttribute(), probably behind an admin servlet with a logon, to notify the container that it is time to reload the <option> value from the database.
servletContext.getAttribute("Mylist").reload();
Thanks Bear!
|
 |
 |
|
|
subject: Dropdown Change HTML <select><option>
|
|
|