User Preferences in Java EE Application

I have a growing web application that should now be able to store user and system settings / settings. I used to always order my own preference system for web applications, but I was wondering what other people do to solve this problem? Are there any preference libraries for web apps that people can recommend?

Ideally, user preferences should have a default value, which the user can then override. Not all preferences should be accessible to the user, although some of them will be for things like the last position of the dialog box.

If I switch to my own route, I think it will be a separate preference table with all the preferences stored as strings converted to their true, primitive, data type as needed. for example, the table has something like a key, user_key, setting_name, setting_value. I approve this approach to the column for each data type, because it stops the installation, which accidentally ends with two values, and the consumer of the setting must know what type of data they want.

+7
java java-ee-6 preferences
source share
2 answers

One approach we use:

  • all optional properties have default values ​​in the code
  • delivers a properties file with a web application in which we define technical properties
  • query the SQL table when the application starts to load mainly function-oriented properties

Properties from the database take precedence over properties from the included property file. If your requirement is to prevent functional managers from changing technical properties, you can add a context column to the property table, which is checked in the management user interface.

All that gets the application code is one globally used collection of properties.

+3
source share

There is a JDK API for this: java.util.prefs

http://java.sun.com/j2se/1.4.2/docs/guide/lang/preferences.html

-3
source share

All Articles