2 Replies Latest reply on May 3, 2007 6:45 AM by mohan_chaudhari

    How can i get portlet instance id

    mohan_chaudhari


      Hi,

      In portlet-instance.xml i have something like

      <instance-id>myInstance</instance-id>
      <portlet-ref>myPortlet</portlet-ref>

      <instance-id>myInstance1</instance-id>
      <portlet-ref>myPortlet</portlet-ref>

      Both instances pointiong to same portlet-name.

      and in portlet.xml i have

      <portlet-name>myPortlet</portlet-name>
      <portlet-class>ReportPortlet</portlet-class>

      Now in ReportPortlet.java how can i get instance id ?
      Because depending on instance-id i want different processing.
      can it be possible ?

        • 1. Re: How can i get portlet instance id
          engela

          Do you really want a different processing to be dependant on the portlet instance id? Surely your portlet code should depend on a portlet instance.

          Wouldn't it be better to add a property to your portlet and depending on the value of the property you have a different processing. That way you can create portlet instances with different processing.

          • 2. Re: How can i get portlet instance id
            mohan_chaudhari


            Thanks engela,
            You suggest to add a property to portlet . Is that mean adding preferences to portlet-instance.xml ? or something else ?

            If it is by setting preferences then i am currently doing the exact thing if it is different please let me know.