• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About usage of Portlet Preference and Portletconfig

 
siva prakash
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

what is difference between portletPreference and portletConfig objects.





Thanks,
prakash
 
Amarender Reddy
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should help you on PortletPreferences.
 
siva prakash
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic