PJM
August 6th, 2004, 04:58 PM
Table: State
Col1: StateCode
Col2: StateName
Currently, a new class is being created, new( StateHM), where a hashmap is created after a sql call to the db with key being StateCode. A new class for every jsp page, action class, and servlet that uses StateCode(select entity HTML, etc.). This is bad.
How should a lookup table be accessed?
1. db called once
2. hashmap(s) need to be created once. Not sure exactly, since I may have the StateName and need to get StateCode and vica-versa.
3. static functions?
4. servletcontext vs class?
It will be accessed in both servlets and jsps. So I will need code to generate HTML select enities, as well as some method to use in html:select tags
Just curious, best practice.
Col1: StateCode
Col2: StateName
Currently, a new class is being created, new( StateHM), where a hashmap is created after a sql call to the db with key being StateCode. A new class for every jsp page, action class, and servlet that uses StateCode(select entity HTML, etc.). This is bad.
How should a lookup table be accessed?
1. db called once
2. hashmap(s) need to be created once. Not sure exactly, since I may have the StateName and need to get StateCode and vica-versa.
3. static functions?
4. servletcontext vs class?
It will be accessed in both servlets and jsps. So I will need code to generate HTML select enities, as well as some method to use in html:select tags
Just curious, best practice.