• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>> 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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>> 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
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

/// 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.
  •  
    Cameron Wallace McKenzie
    author and cow tipper
    Posts: 5009
    1
    Hibernate Spring Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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
    Posts: 23
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,

    Please provide the piece of code you are using to load the preferences and to save the preferences.
     
    Keynes Paul Paul
    Greenhorn
    Posts: 11
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.
     
    If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic