0 Replies Latest reply on Sep 25, 2008 3:19 PM by esmith1

    portlet doView called when not displayed in region

    esmith1

      During the rendering of a page in the Dashboard I am seeing that all portlets assigned to the page, regardless of their assigned layout region, have their doView() method called. This is an unnecessary performance overhead; only portlets which will be rendered should have their doView() called.

      For a simple test I created a HelloWorldJSPPortlet and added 2 log.error() calls which display output on the console showing the portlet is executing its doView, and displaying the portlet instance/window-specific value.
      In Configure Dashboard I used the "generic" layout and assigned the portlet to both the left and the center regions. In the portlet VIEW I told the left one its name was alpha and the center one its name was zeta. All good so far and the console shows both alpha and zeta doView.
      I then enter Configure Dashboard and change the layout to "1column" (center region only), return to the Dashboard which correctly shows only zeta, BUT the console shows that both alpha and zeta were asked for their doView which is overkill because alpha will never be displayed in this layout.

      12:44:17,196 ERROR [HelloWorldJSPPortlet] in doView
      12:44:41,457 ERROR [HelloWorldJSPPortlet] yourname: alpha
      12:44:41,488 ERROR [HelloWorldJSPPortlet] in doView
      12:44:41,488 ERROR [HelloWorldJSPPortlet] yourname: zeta
      

      This can become a performance problem when a user has slow performing portlets in the other regions which are not displaying (or dozens of portlets in those regions), yet the user doesnt realize that to improve performance they need to go into the dashboard, change the layout back so they can see the obscured region, delete the offending portlet(s), then change the layout to the one they wanted.

      Our preferred solution is that rendering of a dashboard page should only call doView for the portlets which will be displayed on that page (e.g. only portlets belonging to regions belonging to the layout being used).

      We like the ability to "go back" to a layout used previously and see the portlet windows still assigned to it, so we are not enthusiastic about the solution which would delete portlet windows from regions (which dont exist in the new layout) during the layout change activity in Configure Dashboard.

      Last, as a temporary workaround, is there any way a portlet doView() method can determine both: what region it is mapped to, and whether that region will be rendered/belongs to the layout being used for the dashboard? If so, I could have all doView() methods simply return; under that condition.