You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Bjorn Vidar Remme <bj...@intentia.no> on 2004/07/08 09:49:32 UTC

Multiple portlet instances and action event execution order

Hi all, 

i have a pane with multiple portlets of the same type added. Works 
perfectly now, this was a issue before, but it is solved nicely. Thanks to 
the individuals who made that possible : 

The portlets are configured to behave differently, but the share some 
common data. We store the common data in the RunData object. We can store 
data on three different levels: UserSace (rundata.getUser.setTemp()) , 
PortletgroupSpace  (homebrewed) and PortletSpace (using the portlet id). 
This also works perfectly.

My problem now is how to handle the action events fired from these 
portlets. 
If I do the following (velocity): 
<form action="$jslink" name="RundataTest" method="POST">
<input type="submit" name="eventSubmit_doBrowse_refresh" value="Refresh" >
</form>

the doBrowse_refresh() method is called for all the portlets on the page 
with the same input values. This of course overwrites all the portlet 
unique values in rundata. The events look like this:
-       doBrowse_Refresh() for portlet 1
-       buildNormalContext() for portlet 1
-       doBrowse_Refresh() for portlet 2
-       buildNormalContext() for portlet 2


I then modified the code to use the portlet id. This is based on the HTML 
source for the portlet controls. I manually add the portletid to the 
context:

<form action="$jslink/js_peid/$!portletid" name="RundataTest" 
method="POST">
<input type="submit" name="eventSubmit_doBrowse_refresh" value="Refresh" >
</form>

Is there a equivalent to $jslink that would automatically do this?

The result was better but not as expected. Now it turned out that the 
ordering on the pane was important. Lets say that we click on Portlet 2 
which is the portlet on the left side of the pane. 
The events then look like this:
-       buildNormalContext() for portlet 1
-       doBrowse_Refresh() for portlet 2
-       buildNormalContext() for portlet 2


Almost what I want! The problem now is that portlet 1 is displaying old 
data, because the global/group entires in rundata was updated after the 
buildNormalContext() method was executed. If we click on Portel 1 
everything works perfectly, because the events now look like:
-       doBrowse_Refresh() for portlet 1
-       buildNormalContext() for portlet 1
-       buildNormalContext() for portlet 2


Is it possible to get the action event to always be handled first 
regardless of which portlet the request was sent from, i.e. the events 
after clicking on portlet 2 should be:
-        doBrowse_Refresh() for portlet 2
-       buildNormalContext() for portlet 1
-       buildNormalContext() for portlet 2




Med vennlig hilsen/Kind regards,

Bjorn Vidar Remme
Application Engineer