What is the best practice for populating dropdown lists in case of XPages application:
- the list items managed in the administration menu and displayed using @DbColumn/@DbLookup
- the list items stored in property files and retrieved using SSJS
For better performance which can be the preferred solution in case of:
- n. of list items<10
- n. of list items<100
- n. of list items<1000
- n. of list items<10000
Neither nor!
A VERY smart way is to have one (or two) beans that hold all the properties you would be eventually looking for. If that are global values an applicationScope is the right place. For user specific ones it is the sessionScope. Your value population will be easy in the XPage:
AppSetup.departments(that is EL code, not SSJS!) where AppSetup is the managed bean name and departments translates into .getDepartments();You can start with a simple lookup inside the bean and later add caching and alternate storage (e.g. a MIMEDoc) as you deem fit. Since your “contract” are the public methods you can optimize internally to your hearts desire.
Here is a SSJS version of the caching lookup, but you want to go for the bean since it allows you to use EL which adds a little extra speed.
One remark: you know that a kitten must die every time a dropdown list has more than 100 entries. That so NOT suitable for UX. For large values use a grid with search capabilities or other UX elements.