3 Replies Latest reply on Jan 10, 2006 5:06 PM by mholzner

    Please help with architecture

    alexeyg

      Hello,

      I am somewhat new to JSR-168 and Portlets, trying to figure out how to do what we need to do (or why we need to do it some other way).

      Let's say there is a Portal with multiple Portlets on it. There is the Navigation Portlet on the left side (menu), a Quick Search portlet on the right, and a Portlet displaying some content in the middle.

      Scenario 1:

      User clicks on a link located in Navigation Portlet. We need to display appropriate content in the main area. How can we do this?

      Option 1) A central portlet managing all content. How can we achieve intrer-portlet commucation to make it work? The navigation portlet would have to tell the central portlet what to show. Sounds like a snakepit of problems.

      Option 2) Different interchangable portlets in the middle. This would work really well, but I do not know if it is even possible. Can we dynamically tell JBoss Portal to show a certain portlet in a certain area of the screen? There is very little documentation on portlet aggregation...


      Scenario 2:

      Similar to scenario 1. Say clicking on Quick Search portlet opens it up in Advanced Search mode. This means Search Portlet will have to be placed in the middle of the screen in Maximized mode, and also not display the Quick Search part.

      This sounds really messy. The Portal generally determines where the Portlet is displayed, right? So having portlets dictate the layout would be messy.


      Has anybody dealt with this before? Any help is appreciated because I cannot seem to find anything on this matter at all. There must be good ways to change layout dynamically, move portlets around, etc. Yet all examples deal with displaying portlets in different window modes in the same area of the screen. Nobody mentions scenarios where portlets in Normal mode are displayed in one area, and portlets in Maximized mode are displayed in another are of the screen.

      Please help! Thanks in advance.

        • 1. Re: Please help with architecture

          this doesn't sound all to complicated

          scenario 1)
          what is the content that is displayed in the middle ? Is this always something from the same source (like a CM) , or is it an RSS feed for one selection, and an email reader for another, etc. ?

          Example:
          if the list is a list of names and the portlet in the middle is a sql query that gets some details from the db for the selected name, then this is IPC (inter portlet communication; the portlets stay the same, only the content changes) .
          If, however, the list is more of a menu, and the content in the middle is much more diverse, then you'll need a page for each selection. The page contains the portlets it needs to display whatever it is that this selection does.
          The difference is that in the first example you'd have one page with a selection portlet and a display portlet , and those two portlets communicate (via the session, or via JBP's IPC; you can see examples for that in the Test page in the default portal). In the second example you'd have several pages that all have the navigation portlet in them, plus in addition they'd have one or more portlets that display the rest of this selection.

          Portlets are assigned to a page. This page assignment is called a Window. The window definition has attributes like region, height, and instance-ref.
          The region determines where on the page the portlet shows up (the region is driven by the layout and theme). The height determines the order of the portlets in one region (if there are more then one in the same region). The instance-ref points to the portlet instance to render in this window.
          You can create pages in the *-object.xml descriptor, or you can do that via the management UI (available when you log in as admin)

          scenario 2)
          The default behaviour of maximized is that the portlet gets the entire page, so that shouldn't be a problem.

          All of this behaviour can be customized and made more dynamic via the layout, the theme, and the layout strategy. Look at the theme documentation in the reference guide for much more detailed information about this.

          • 2. Re: Please help with architecture
            alexeyg

            Thanks for your reply!

            I have finally resolved Layout/Theme issues and now actually trying to get this to work.

            I have a question regarding the Example. What would be the best way of generating links and deciding which one the user pressed?

            A book I have says "The details of how a URL points to a specific instance of a portlet are up to the portal container. so rather than creating a URL ourselves, we use the portlet's render response object to create a portlet URL for an action request."

            Let's say I have a Navigation portlet on the left and a Content Portlet in the middle. Navigation Portlet has links to Home, Here, There. Clicking on any of those should make the Content portlet display the appropriate message (i.e. "we are Home").

            I understand that the RenderResponse object is specific to individual Portlets... which means I cannot generate Content Portlet Action URLs from Navigation Portlet, correct? In other words, I cannot create a Form that would be displayed in portlet A and submitted to portlet B?

            Does this mean I have to append things directly to the UR, i.e. generate a standard actionURL for the Navigation Portlet and append "action=home" or "action=here"? Navigation Portlet would then pick those up and stuff them into session, allowing Content Portlet to display appropriate content... is this the way to go?

            • 3. Re: Please help with architecture

              You could 'mess' with the URLs, but I wouldn't recommend it.

              Take a look at the IPC (inter portlet communication) functionality.
              There is an example in the core -> see the Test -> event test page (sample-portlets-war, and core/src/main/org/jboss/portal/core/portlet/test/event)

              Sure, this is proprietary, but any approach you can take here will end up being specific for the portal you run in (URL format dependency, etc. )