File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Reply 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: 4962

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 ]

Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
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
 
 
subject: About usage of Portlet Preference and Portletconfig
 
Threads others viewed
How to retrieve portlet id within a portlet code?
changing Portlet Preference
regulate preferences
Application Scope Session in IBM portal server
Liferay: NullPointerException on load.
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture