Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.2
-
Component/s: ICE-Components
-
Labels:None
-
Environment:All
-
ICEsoft Forum Reference:
-
Support Case References:
Description
"Even though at render time 2 different resource objects are instantiated with different parameters, when I click on the button intended to retrieve the particular resource , one resource is actually retrieved independent of which button I click on..."
I've run the sample war in the forum post and have confirmed the issue. Nothing in their code looks out of the ordinary. Attached is the war file ready to be deployed on Jboss 4.2.2.
http://localhost:8080/OutputResource/table.iface
-
- OutputResource.java
- 9 kB
- Tyler Johnson
-
Hide
- OutputResource.war
- 4.25 MB
- Tyler Johnson
-
- META-INF/MANIFEST.MF 0.0 kB
- xmlhttp/css/.../tree_nav_middle_open.gif 0.2 kB
- xmlhttp/css/.../tbot-off-mid-top.gif 0.8 kB
- xmlhttp/css/xp/css-images/folder.gif 0.6 kB
- xmlhttp/css/.../tbot-on-left-top.gif 0.1 kB
- xmlhttp/css/.../node_close_middle.gif 0.1 kB
- xmlhttp/css/.../over-right-mid.gif 0.1 kB
- xmlhttp/css/xp/css-images/tab-over.gif 0.6 kB
- xmlhttp/css/.../tbot-over-mid-top.gif 0.0 kB
- xmlhttp/css/.../css-images/cal_off.gif 0.6 kB
- xmlhttp/css/.../contentContainer_bg.gif 0.1 kB
- xmlhttp/css/.../tree_nav_bottom_open.gif 0.1 kB
- xmlhttp/css/.../tree_line_middle_node.gif 0.1 kB
- xmlhttp/css/.../css-images/over-left-top.gif 0.1 kB
- xmlhttp/css/.../css-images/arrow-first.gif 0.2 kB
- xmlhttp/css/.../css-images/Tab_RtTop.gif 0.1 kB
- xmlhttp/.../tree_nav_top_open_no_siblings.gif 0.1 kB
- table.jspx 0.6 kB
- xmlhttp/css/.../css-images/over-mid-bot.gif 0.0 kB
- xmlhttp/css/.../tbot-off-left-bot.gif 0.8 kB
- xmlhttp/css/.../css-images/on-left-mid.gif 0.1 kB
- xmlhttp/css/rime/css-images/cal_off.gif 0.6 kB
- xmlhttp/css/xp/css-images/remove.gif 0.1 kB
- xmlhttp/css/.../tbot-over-mid-top.gif 0.8 kB
- xmlhttp/css/.../arrow-previous-dis.gif 0.9 kB
- xmlhttp/css/.../css-images/over-mid-mid.gif 0.1 kB
- xmlhttp/css/.../cal_arrow_left_dis.gif 0.9 kB
- xmlhttp/css/.../tree_nav_middle_open.gif 0.4 kB
- xmlhttp/css/xp/css-images/line_last.gif 0.1 kB
- xmlhttp/css/.../table_col_header.gif 0.3 kB
Issue Links
- blocks
-
ICE-3711 ice:outputResource within a dataTable doesn't work
- Closed
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
OutputResource.war
OutputResource.java
I'm not sure if this is the root of problem, but I had changed the getResource() method on the component to actually first check the value binding and set the instance variable off of that to avoid this issue:
http://jira.icefaces.org/browse/ICE-2348#action_22973
public Resource getResource() {
ValueBinding vb = getValueBinding("resource");
resource = (Resource) vb.getValue(getFacesContext());
...
After debugging the code I found out that the problem is due to the reason that "clicking" on the "resource" link, works as request/response mechanism and it doesn't involve JSF Life cycle at all. So the dataTable does not have chance to load the proper row object into the scope.
The OuputResource component uses inner class to define the resource, so to responds the request the ResourceDispatcher invokes the "open" method on the "resource", which uses the reference of the most recently evaluated "resource" object by the outputResource component. That is why every link inside the table brings the same resource and that obviously for the last row of the dataTable.
I couldn't see any straight fix to the component, it might require something to change with Resource API as well. So I am re-assigning it to Mircea.
trunk revision : 17820
Even though there is a single instance of the outputResource component when inside the dataTable, but there are designated resource objects for each resource, that allowed to fix this issue at the component level. The fix is to not to update the reference of instance member of its parent class, use the value binding instead.
Branch 1.7 : revision 17830
Customer has just reported the following:
BEGIN: The problem appears to lie in following:
In the datatable the
<ice:column>
<ice:outputResource>
combination appears to show in OutputResourceRenderer
String clientId = uiComponent.getClientId(facesContext);
OutputResource outputResource = (OutputResource) uiComponent;
shows the uiComponent being the same each time the renderer is called, with clientId different on each row. The uiComponent is not safe to use as a singleton since
public Resource getResource() {
ValueBinding vb = getValueBinding("resource");
resource = (Resource) vb.getValue(getFacesContext());
Where resource is a private member which is then used later in the code in the within Resource r = new Resource() {
To work around the issue until you can resolve it, I have introducted some code enclosed which appears to resolve issue. See internalResource variable.. It is probably now the most optimal way to resolve issue but it works..
END