Hi. I just opened JIRA issue PB-49. As far as I can tell, the problem with 
putting multiple struts portlet instances on a page is that the same form bean 
is used for all portlet instances. A similar problem exists for render 
attributes or anything that is put on the request and sent to the page. I've 
developed a potential fix for this and would like to get some feedback on my 
implementation. I've used the PortletWindow id as a portlet entity id. There 
are two main parts of this implementation.

1. I use this entity id to identify portlet instances and create (if needed) an 
actionForm for each portlet instance. The glue that holds all of this together 
is the ActionMapping. Internally I wrap the ActionMapping with an 
implementation that appends the entity id to the attribute when 
ActionConfig.getAttribute() is called. This entity specific attribute is used 
by the struts tag libs to get the correct ActionForm instance for each portlet 
on the page. 

2. I store render attributes separately for each instance. Each portlet 
instance has its own render attributes on the request at the time it is 
rendered. Render attributes for all instances can be persisted across multiple 
requests.


Actually, in my app I took this one step further and created a custom 
ActionMapping with the boolean property cacheRenderAttributes. This is used at 
the action level in the struts-config to specify that you want render 
attributes cached beyond a single request. This is an alternative to specifying 
every attribute by name in struts-portlet-config.xml

Using the bridge with these modifications, I am able to deploy multiple 
instances of a struts portlet on a page without them clobbering one another. 
This is done without any modification to the struts code, struts config, or jsp 
(with the exception of the custom ActionMapping in the struts-config, and even 
that's not required unless you want to use the cacheRenderAttributes property).



James May
Sr. Software Engineer
Fidelity Investments - EPS
ph 859.386.8069
cell 859.496.0050


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to