my dog learned polymorphism*
The moose likes Portals and Portlets and the fly likes About usage of Portlet Preference and Portletconfig Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "About usage of Portlet Preference and Portletconfig " Watch "About usage of Portlet Preference and Portletconfig " New topic
Author

About usage of Portlet Preference and Portletconfig

siva prakash
Ranch Hand

Joined: Aug 24, 2004
Posts: 80
Hi All,

what is difference between portletPreference and portletConfig objects.





Thanks,
prakash
Amarender Reddy
Ranch Hand

Joined: May 12, 2005
Posts: 54
This should help you on PortletPreferences.
siva prakash
Ranch Hand

Joined: Aug 24, 2004
Posts: 80
thanks reddy,

I have gone thru that page, after that only i got this doubt, why we need this porletpreference object instead of portletconfig







Thnaks,
prakash
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Wow! You're joking, right?

Portlet preferences are user specific. A PortletPreference keeps information about a specific user.

PortletConfig is almost the exact same thing as the ServletConfig. It allows for setting a property that is common to ALL instances of that portlet.

So, if I have a CaliforniaStateTaxPortlet, I can set the tax rate to say, 6%, so everyone using that portlet would get their tax calculated at 6%. Someone might set their income in PortletPreferences. I set my income to $45,000. You set yours to $145,000. Someone else sets theirs to $200,000. That would be set in PortletPreferences - everyone has their own. But what is the tax rate for all of us? Well, it's still 6%.

Now, what if the tax rate goes down in California to 5%. Yea, I know that would never happen, but lets pretend. Well, you make ONE CHANGE in the PortletConfig, and it effects EVERYONE. I now pay 5%, you pay 5%, she pays 5%. BUT, our income hasn't changed in our PortletPreferences - it's completely unique to the user.

There's a HUGE, HUGE difference.

Here's the free tutorial on portlet development you absolutely need to see to understand the configuration objects:

Understanding the JSR168 Portlet Config Objects: PortletContext, PortletConfig, PortletPreferences, etc


Now, ask me about PortletContext..........

-Cameron McKenzie
[ August 09, 2007: Message edited by: Cameron McKenzie ]
Amarender Reddy
Ranch Hand

Joined: May 12, 2005
Posts: 54
I have gone thru that page, after that only i got this doubt, why we need this porletpreference object instead of portletconfig


PortletPreference object is NEVER a substitute for PortletConfig.
So, there is never the question of using PortletPreference INSTEAD OF PortletConfig.

Please go through the portlet API once again. You will realise how unique these two objects are.

cheers
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: About usage of Portlet Preference and Portletconfig
 
Similar Threads
changing Portlet Preference
How to retrieve portlet id within a portlet code?
Application Scope Session in IBM portal server
Liferay: NullPointerException on load.
regulate preferences