Foren

saving portlet preferences

kiesa viciius, geändert vor 12 Jahren.

saving portlet preferences

Junior Member Beiträge: 28 Beitrittsdatum: 22.08.11 Neueste Beiträge
I have made an portlet with an "Preferences" mode for the administrator (he have to make an sql connection to a data base and some further configurations.) Now he connects to the data base, makes some other configurations and adds some charts to the view mode (main portlet site). The problem is that after an relogg the configurations he made dissapear , that means that he have to do the configurations over and over again , and the stuff he adds to the view mode are not being saved either. any suggestions ?

This is what i have tryed so far :

to get the preferences I have added the folowing to my handleResourceRequest method :

this.prefs = request.getPreferences();
boolean configured = Boolean.parseBoolean(this.prefs.getValues("myapp.configured", new String[] { "false" })[0]);

// Have no idea how it works thats the main problem. what does  getParent() do? 
if (configured && PictureA.getParent() == null) {
    viewContent.removeComponent(viewText);
    panel.addComponent(PictureA);
    viewContent.addComponent(panel);
}


to store the preferences i use a button :

			try {
				this.prefs.setValues("myapp.configured", new String[] {"true"});
				this.prefs.store();
			} catch (ReadOnlyException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ValidatorException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}


now my problem is that i dont know how to modify it that to fit my portlet i have an link with some parameters , like : size of my picture background color and some other stuff that i have to set as an administrator in the editContent (the editContent is being updatet also so i would like to save the administrators made configs too) and i cant save/restor it . i always get an "Internal error". I could post some executable code if it helps.

any help is greatly appreciated.
thumbnail
srikanth a, geändert vor 12 Jahren.

RE: saving portlet preferences

Regular Member Beiträge: 144 Beitrittsdatum: 21.02.11 Neueste Beiträge
Hi,
Could you please try with this link

https://www.liferay.com/community/wiki/-/wiki/Main/How+to+Add+Configuration+Page+to+a+Plugin+Portlet


regards
Sri