aspose file tools*
The moose likes Portals and Portlets and the fly likes Portlet Preferences not loading , portlet does not populate table values. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Portlet Preferences not loading , portlet does not populate table values." Watch "Portlet Preferences not loading , portlet does not populate table values." New topic
Author

Portlet Preferences not loading , portlet does not populate table values.

Keynes Paul Paul
Greenhorn

Joined: Feb 18, 2008
Posts: 11
Hi,
I have created a portlet and specified the portlet preferences in portlet.xml file ,and there are no values set for these preferences.When the portal page loads for the first time, i am expecting the portlet with the portlet preferences loaded from the bean table, but it doesnt happen. but after the portlet is loaded,I click on the edit view link and just click the save button without ANY changes , the previously expected values are loaded in the portlet,can anyone please help me with this problem.

please note: I am in a very crucial situation, your kind help is much appreciated.Many Thanks.

Regards,
Keynes.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

>> I have created a portlet and specified the portlet preferences in portlet.xml file ,and there are no values set for these preferences.

So, no values are to be read from the portlet.xml file? So when the portlet loads, nothing should be initialized to any default values.

>>i am expecting the portlet with the portlet preferences loaded from the bean table

I guess this is a different portal than JetSpeed/Pluto/WebSphere, because I have no idea what a bean table is? Sorry.

>>I click on the edit view link and just click the save button without ANY changes

So, it sounds like the initialization of these portlet preferences are happening during the action processing phase. So, the portal page renders the first time, or you go to the edit page, only doView and doEdit are being triggered. But on clicking of the button, sounds like you are triggering your even processing phase, and that's where preferences are being loaded.


Correct me on any incorrect assumptions I've made, and perhaps I can be of more help.

Best luck. I know how frustrating these portlet/portal problems can be to troubleshoot.

-Cameron McKenzie
Keynes Paul Paul
Greenhorn

Joined: Feb 18, 2008
Posts: 11
>> I have created a portlet and specified the portlet preferences in portlet.xml file ,and there are no values set for these preferences.

So, no values are to be read from the portlet.xml file? So when the portlet loads, nothing should be initialized to any default values.

/// we declare the portlet preferences in portlet.xml and because the values are to be loaded from a DB by a bean , we do not hard-code it but instead use the PortletPreferences object in doView() to change it.
we have the code for pulling the values from the DB and assigning it to the preferences, but for some reason , the values doesnt show up , when the portal page is rendered for the first time.


>>i am expecting the portlet with the portlet preferences loaded from the bean table

I guess this is a different portal than JetSpeed/Pluto/WebSphere, because I have no idea what a bean table is? Sorry.

/// its jsr168 portlet,its just a regular java bean class(model) which access the DB and populate the values
>>I click on the edit view link and just click the save button without ANY changes

So, it sounds like the initialization of these portlet preferences are happening during the action processing phase. So, the portal page renders the first time, or you go to the edit page, only doView and doEdit are being triggered. But on clicking of the button, sounds like you are triggering your even processing phase, and that's where preferences are being loaded.

// you are right i see the pref are read and the values are updated and stored in the processAction(),

So how do we migrate it to the doView()??

Cameron please suggest


Correct me on any incorrect assumptions I've made, and perhaps I can be of more help.

Best luck. I know how frustrating these portlet/portal problems can be to troubleshoot.

-Cameron McKenzie
Hemant Sharma
Greenhorn

Joined: Feb 01, 2007
Posts: 23
/// we declare the portlet preferences in portlet.xml and because the values are to be loaded from a DB by a bean , we do not hard-code it but instead use the PortletPreferences object in doView() to change it.
we have the code for pulling the values from the DB and assigning it to the preferences, but for some reason , the values doesnt show up , when the portal page is rendered for the first time.


Portlets can only modify preferences attributes during a processAction invocation. It seems you are trying to set the preference value in doView() and NOT calling the store() method, otherwise you would have got IllegalStateException. Please note you can't modify preferences in render phase.

Following may serve as workaround for your problem in doView:
  • You can pass value from DB as the default value parameter while invoking the getValue() or getValues() methods of PortletPreferences to get values of respectice preferences.
  • Have logic to print/show the above preferences values in View mode.


  • Thanks & Regards,<br />Hemant K. Sharma
    Cameron Wallace McKenzie
    author and cow tipper
    Saloon Keeper

    Joined: Aug 26, 2006
    Posts: 4968
        
        1

    BINGO!!!

    You can't edit the portlet preferences during the view phase; only the edit phase. This is part of the portlet specification.

    -Cameron McKenzie
    Keynes Paul Paul
    Greenhorn

    Joined: Feb 18, 2008
    Posts: 11
    Hi,
    Accept, that the prefs can be changed during doEdit(), but to be exact I am just trying to load the prefs.Here's the scenario.The User logs in and sets his/her prefs by going to the edit page e.g how many and what columns to display and how many rows to display etc) after saving the prefs the user signs out and sign-in .Now,I want to load what the preferences what the user has set previously and dont want the prefs to change to default unless the user wishes to change.
    So, the loading part is where i am stuck up with , could you please provide your valuable help ,Many thanks.

    Regards,
    Kenny.
    Hemant Sharma
    Greenhorn

    Joined: Feb 01, 2007
    Posts: 23
    Hi,

    Please provide the piece of code you are using to load the preferences and to save the preferences.
    Keynes Paul Paul
    Greenhorn

    Joined: Feb 18, 2008
    Posts: 11
    Hi Hemanth,
    Do you have a number so that I can talk to , Im in bangalore
    I dont think so I can post the code here.I think its sensitive. Kindlly suggest.

    Regards,
    Keynes.
     
     
    subject: Portlet Preferences not loading , portlet does not populate table values.