This content has been marked as final.
Show 6 replies
-
1. Re: can't access preference at runtime
mohan_chaudhari May 2, 2007 5:59 AM (in response to mohan_chaudhari)the portlet-instance contains :
name
XYZ -
2. Re: can't access preference at runtime
theute May 2, 2007 6:11 AM (in response to mohan_chaudhari)use [ code ] [ / code] with no space to write markup
Didn't you mean"String pref = null; pref = request.getPreferences().getValue("name", "foo"); System.out.println(pref);
You are not setting up pref... -
3. Re: can't access preference at runtime
mohan_chaudhari May 2, 2007 6:31 AM (in response to mohan_chaudhari)Thanks
I put following in portlet-instance.xml<preferences> <preference> <name>name</name> <value>mohan</value> </preference> </preferences>
so the preferences are already set i just want to
fetch their value in java code. -
4. Re: can't access preference at runtime
theute May 2, 2007 8:21 AM (in response to mohan_chaudhari)And what's wrong in the code i wrote ?
-
5. Re: can't access preference at runtime
mohan_chaudhari May 3, 2007 1:08 AM (in response to mohan_chaudhari)
The java code works if i put<preferences> .... </preferences>
in portlet.xml but if i put preferences in portlet-instance.xml it gives me null instead of giving value of preference. -
6. Re: can't access preference at runtime
theute May 3, 2007 7:00 AM (in response to mohan_chaudhari)You can set up preferences in portlet-instances.xml (note the 's' at the end).
Show more of your portlet-instances.xml file. You can also look at the NewsPortlets in core-samples to see it used.