3 Replies Latest reply on Jun 3, 2008 4:54 PM by Peter Johnson

    Design Portlet

    gopikrishna krishna Newbie

      Hi All,

      I am a bit new to this Portal/Portlet.

      I have some question regarding the portlet design.

      My requirement is to develop a portal application which has around 900 screens.

      My design specific questions are ,

      1. Howmany portlets ('class' extends GenericPortlet) will I be having in my design? Do I need to have that may Portlets?
      2. Does it mean that, one sceen is one portlet?

      Thanks in advance,
      Regards,
      Gopi

        • 1. Re: Design Portlet
          Peter Johnson Master

          Actually, a portlet is only a small part of a screen. If you look at the default portal provided by JBoss Portal, the home page has around 5 portlets.

          Also, a single portlet can appear multiple times, both on a given page, and on multiple pages. As an example, one of my portlets has a certain portlet appearing 4 times on the home page, and then once or twice on all of the other pages.

          It also depends on how the screens are designed. Another of my portals places all of the html text within the Content Management System (CMS) and then uses the CMS portlet (which appears on multiple pages) to display the HTML. In this case there is a lot of data being presented to the user, but very little input. Input will typically require its own portlet.

          • 2. Re: Design Portlet
            gopikrishna krishna Newbie

            Hi Peter,

            thanks for the reply!

            So, how does your 'portlet-instances.xml' look like?

            <?xml version="1.0" standalone="yes"?>
            <!DOCTYPE deployments PUBLIC
            "-//JBoss Portal//DTD Portlet Instances 2.6//EN"
            "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">



            <instance-id>portlet-1</instance-id>
            <portlet-ref>portlet-1Portlet</portlet-ref>


            <instance-id>portlet-2</instance-id>
            <portlet-ref>portlet-2Portlet</portlet-ref>


            <instance-id>portlet-3</instance-id>
            <portlet-ref>portlet-3Portlet</portlet-ref>

            .....................
            ....................

            <instance-id>portlet-n</instance-id>
            <portlet-ref>portlet-nPortlet</portlet-ref>




            Is it possible to have one generic portlet and the rest extends it?

            Thanks in advance!
            Regards,
            Gopi

            • 3. Re: Design Portlet
              Peter Johnson Master

              To declare multiple instances of a portal, assuming the portal is named p1, portlet-instances.xml would contain:

              <deployments>
               <deployment>
               <instance>
               <instance-id>inst1</instance-id>
               <portlet-ref>p1</portlet-ref>
               <preferences>
               <preference>
               <name>xxx</name>
               <value>aaaaaaa</value>
               </preference>
               </preferences>
               </instance>
               </deployment>
               <deployment>
               <instance>
               <instance-id>inst2</instance-id>
               <portlet-ref>p2</portlet-ref>
               <preferences>
               <preference>
               <name>xxx</name>
               <value>bbbbbbb</value>
               </preference>
               </preferences>
               </instance>
               </deployment>
               . . .
              </deployments>
              


              The key is that the portlet is coded to use the use the preferences to customize it.

              You can define a base portlet class that does a lot of the common tasks and extend that class. You would then, in portlet.xml, declare a portlet for each of the subclasses.