as Knut Hermann already mentioned in his commented check out his [example][1].
If you want to be able to add new configs to your bean via a add button or if you are just to convienient to write a getter and setter for all your configuration properties you can implement the DataObject and iterate over all documentItems to write them to your bean:
public class ConfigBean implements DataObject {
private static HashMap<Object,Object> config = null;
public ConfigBean() throws NotesException, IOException, ClassNotFoundException{
config = new java.util.HashMap<Object,Object>();
readFromDocument();
}
public void readFromDocument() throws NotesException, IOException, ClassNotFoundException{
Database db = ExtLibUtil.getCurrentSession().getCurrentDatabase();
View view = db.getView("Config");
Document doc = view.getFirstDocument();
//read all Items from document
Iterator<Item> items = doc.getItems().iterator();
while(items.hasNext()){
Item item = items.next();
setValue(item.getName(), item.getValueCustomData());
}
doc.recycle();
view.recycle();
db.recycle();
}
public void saveToDocument(){
//.. write the HashMap back to your document.
}
public Class<ConfigBean> getType(Object id) {
return ConfigBean.class;
}
public Object getValue(final Object key) {
if (key == null) {
throw new IllegalArgumentException("Key cannot be null.");
}
return config.get(key);
}
public boolean isReadOnly(Object arg0) {
return false;
}
public void setValue(final Object key, final Object value) {
if (key == null) {
throw new IllegalArgumentException("Key cannot be null.");
}
config.put(key.toString(), value);
}
}
Sorry was not able to post the code...
To save your bean back to your document you will have to add a method wich loops through the HashMap and writes the values back to your document. You can call this method in a save Button in your configuration form on your xpage.
To manipulate the values of the bean via xpage you can just call ConfigBean.key = "value", ConfigBean.setValue("key","value") or just bind them to a input field:
[1]: How to set up a managed bean to work with Notes document
title js: <xp:inputText id="inputText1" value="#{javascript:config.applicationTitle}" /> <xp:br /> title EL:  <xp:text escape="true" id="computedField1" value="#{config.applicationTitle}"/> <xp:br/> <xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true"/></xp:button></xp:view>
Things works fine (as long as I have a Notes document in the view ofcourse). I wonder how I can submit changes back to the Notes Document via the Managed Bean probably via a specified save method? – Malin