4 Replies Latest reply on Jan 19, 2006 1:40 PM by alessandroribeiro

    How to create a Portlet to add a new Window to a page

    alessandroribeiro

      Hi,

      I´m trying to create a Portlet, a bit like the ManagementPortlet, but simpler and which not only administrators, but common users as well can use it to add new Windows to a page. I would like it to behave like the "Add Portlet" combobox in Liferay.

      I´m using the PortalNode API, as shown in the Portal Webinar, to get a pointer to the current page and to get the list of windows under a page, but I still don't know how to:
      1) get the portlet instance associated to the window;
      2) get the list of all portlet instances to fill in the combo box;
      3) dynamically add an instance to a page;

      Thanks in advance,

      Alessandro

        • 1. Re: How to create a Portlet to add a new Window to a page
          alessandroribeiro

          I have just read some pieces of the code of the management portlet. As it is a JSF application, I decided to take a look at the faces-config.xml. As far as I can see, the objects I should use to create/remove instances,windows,pages are saved in the session and the application scope.

          As my portlet is a simple JSR168 portlet, how can I access the ServletContext from within the PortletContext and how can I access the ServletSession from within the PortletSession ? The JSR-168 states that "The PortletContext must offer access to the same set of resources the
          ServletContext exposes", but I cannot see in it, any of the objects exposed in the faces-config.xml.

          For example, in the faces-config.xml, in the configuration of the InstanceManagerBean, it is written that the value of the InstanceContainer variable of the application scope is injected into the bean.

          <managed-property>
          <property-name>instanceContainer</property-name>
          #{applicationScope.InstanceContainer}
          </managed-property>

          Nonetheless, when I try to access the InstanceContainer directly, using the PortletContext, I can´t find it. In fact, I don´t find any of the variables listed in the faces-config.xml.

          What might be wrong in my application ?


          Thanks,

          Alessandro

          • 2. Re: How to create a Portlet to add a new Window to a page
            alessandroribeiro

            Does Anyone know or have an example how I can access those variables inside a Portlet ?

            • 3. Re: How to create a Portlet to add a new Window to a page

              You can look at the management portlet.

              • 4. Re: How to create a Portlet to add a new Window to a page
                alessandroribeiro

                Can I create this portlet just using the JSR168 API, without using JSF ? Is there any dependence on the use of JSF ?

                Alessandro