1 Reply Latest reply on May 8, 2008 9:29 AM by francescglez

    Several portlets sharing one bean

    francescglez

      environment:
      JBOSS 4.0.5.GA
      PostGreSQL
      MyFaces 1.1.5.
      RichFaces 3.1.2

      I have a complete web application packed in a WAR file that includes a BackBean, one jsp, and a portlet with all descriptors files.This application is just a table (HtmlDataTable) with pagination and with different ModalPanels to edit(create, delete...) one kind of object. Now I wanna reuse this table in other portlets with other kind of objects but the way I do is wrong. I think I'm just calling same instance of the backbean from all portlets. What I want is call totally different instances of the backbean packed in the war file in order to get two DataTables managing different objects and totally independents in two differents portlets but in the same portal.

      Thank you very much for any help.

      Frank

      This is a copy of the descriptor files packed in the war file:

      portlet #1
      ----------------------------------------------------------------------------------
      custom-object.xml

      <page-name>Data Management</page-name>
      ................

      <window-name>Sdo</window-name>
      <instance-ref>SDOPortletInstance</instance-ref>
      left
      600




      portlet-instances.xml


      <instance-id>SDOPortletInstance</instance-id>
      <portlet-ref>SDOPortlet</portlet-ref>



      portlet.xml


      <portlet-name>SDOPortlet</portlet-name>

      <portlet-class>de.modules.sdo.SDOPortlet</portlet-class>

      <init-param>
      default-view
      /sdo.jsp
      </init-param>
      ..................................




      portlet #2
      ----------------------------------------------------------------------------------
      custom-object.xml

      <page-name>Data Management</page-name>
      ................

      <window-name>Sdo</window-name>
      <instance-ref>SDOPortletInstance2</instance-ref>
      left
      600




      portlet-instances.xml


      <instance-id>SDOPortletInstance2</instance-id>
      <portlet-ref>SDOPortlet</portlet-ref>



      portlet.xml


      ........... NO REFERENCE TO THE SDOPortlet .............

        • 1. Re: Several portlets sharing one bean
          francescglez

          ok, fixed!,

          1) The dataTable must be packed in a Portlet in the WAR file. In its portlet.xml and portlet-instances.xml descriptors, I must declare a new portlet instance with a diferent <instance-id>(one for evey kind of objects I want to manage)

          2) In every Portlet I want to inject this dataTable, in its ***-object.xml file I have to write a reference to last <instance-id> name.