apps-infra

    Forum Stats

  • 3,873,824 Users
  • 2,266,678 Discussions
  • 7,911,636 Comments

Discussions

Dynamic Content for content presenter portlet

653103
653103 Member Posts: 114
edited Nov 10, 2008 12:56PM in WebLogic Portal
Is there a way to load dynamic content at the content presenter portlet, and keep the functionallity of its wizard, for example the content presenter portlet will change the content depending on the query passed in the request

http://www.myweb.com/myapp/myportal/mydesktop -> The content presenter shows a default and preconfigured content from repository

http://www.myweb.com/myapp/myportal/mydesktop?content=/someContentInRepository -> The content presenter shows the Node in Repository that matches with the one in the query

any idea on what files should i modify or if i have to write my own content presenter :(

Thanks

Edited by: Oscar <Soker> on Sep 4, 2008 9:41 AM

Best Answer

  • 648793
    648793 Member Posts: 96
    edited Sep 8, 2008 1:29PM Answer ✓
    You can use javax.portlet.PortletPreferences to change the prefrence. See java doc for more information. You have to find the key in the portlet. This can be done if you open the portlet in workshop. Then on run time you can set the value for that key

    Edited by: NowWLP102 on Sep 8, 2008 10:28 AM

Answers

  • 648793
    648793 Member Posts: 96
    Well if you want to change the content based on some event i.e. some button/link clicked etc then it is possible.
    Content Presenter store the content path in the portlet preference. When the portlet is loaded it picks up the path from prefrence and show the content. If you have enough rights, then you can update the preference to point it to new content.
    Can you explain me what exactly are you trying to do? Because i think the whole idea of content presenter is to choose the content and template, and display them.

    Let me know if it works for you.

    Thanks
    648793
  • 653103
    653103 Member Posts: 114
    yeah it is helpfulll what i'm going to do now is to find the piece of code that uses the preference to set the content to load and i'm gonna change it to search first for a parameter and then if paraeter does not exist load the content inthe preference
  • 648793
    648793 Member Posts: 96
    edited Sep 8, 2008 1:29PM Answer ✓
    You can use javax.portlet.PortletPreferences to change the prefrence. See java doc for more information. You have to find the key in the portlet. This can be done if you open the portlet in workshop. Then on run time you can set the value for that key

    Edited by: NowWLP102 on Sep 8, 2008 10:28 AM
  • 653103
    653103 Member Posts: 114
    o.O thanks, that's whati was looking for
  • Another mechanism would be to use a Content Selector as the source for the Content Presenter portlet instance. You can author a Content Selector that would search content based on a request attribute. Then, a Content Presenter instance that is configured to use that Selector would be able to render the content defined in the URL parameter. With this, you wouldn't have to update preferences on the portlet and each user could see something unique (based on their particular URL parameter).

    In WLP 10.2, the Content Presenter sample webapp demonstrates a similar approach. When you select a "Press Release" in the Avitek in the News portlet, the page changes to display a Content Presenter portlet that uses a Content Selector to pick and render the selected press release.
    Brad Posner-Oracle
  • 653189
    653189 Member Posts: 101
    Hi ,

    Pls see my requirement similar to this thread.


    And still looking for alternative

    2771947

    Srinivas
  • 653189
    653189 Member Posts: 101
    Sorry all,,,

    Mistakely sent this message
  • 653103
    653103 Member Posts: 114
    oh thanks, that's a great idea i'll take it in consideration
  • Sorry this is so late, I just found this thread.

    Several of Content Presenter's content retrieval methods are dynamic already: "Results of a Search Query" and "Contents of a Folder"

    Both of these options show the current results from CM, not the results that existed when the Wizard was used.

    Another approach would be to put the overriding logic in your display template JSP.

    The template can do whatever it wants with the content node or nodes handed to it by Presenter, including ignoring it and using other content instead.

    So your display template JSP could inspect the request for an overriding parameter and use that node instead.

    Regards,
    Chris Bales
This discussion has been closed.
apps-infra