Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.1-Beta
-
Component/s: ACE-Components
-
Labels:None
-
Environment:Tomcat 7.0.12
ICEfaces-2.1.0.BETA-10022011-src
-
Assignee Priority:P1
Description
The problem is that actions on JSF page do not trigger server-side action code. The issue is caused by ace:menuBar. Here is a typical menu item Onclick function that is generated by BaseMenuRenderer:
<a onclick="if(!OneLineApp.performAction('Submit Confirmation',this))return;showProcessingMessage('Performing Action');;ice.ace.ab({source:'sub_0:listPgFrm:j_id15',process:'@all',params:{'ice.customUpdate':'sub_0:listPgFrm:j_id15'}});" href="#" class="wijmo-wijmenu-link ui-corner-all"><span class="wijmo-wijmenu-text"><span class="wijmo-wijmenu-text">Submit Confirmation</span></span></a>
Note the highlighted code uses the component clientId. This client id is used in ice.ace.AjaxRequest as follows:
148 var form = $(ice.ace.escapeClientId(cfg.source)).parents('form:first');
149 if(form.length == 0) {
150 form = $('form').eq(0);
151 }
It tries to get the containing form of the menu item using the clientId. Unfortunately the client id is never rendered into HTML by BaseMenuRenderer. So line 148 does not return anything and ICEFaces always uses the first form as the submitting form. Our navigation menu happens to be the first form so it works. Our action menu is not the first form, so the wrong form is submitted.
The unresponsive second ace:menubar is reproducible in the poc. Screen 1 now has a ace:menubar with 'Print' in the top right of the tabpane content. When this menuitem is clicked, a post is sent to the server but the actionListener is not executed.
-
- screen1.xhtml
- 10 kB
- Brad Kroeger
-
- Screen1.java
- 11 kB
- Brad Kroeger
-
Hide
- Case10445Example.zip
- 18 kB
- Arran Mccullough
-
- Case10445Example/build.xml 3 kB
- Case10445Example/.../ant-deploy.xml 2 kB
- Case10445Example/.../build-impl.xml 59 kB
- Case10445Example/.../genfiles.properties 0.5 kB
- Case10445Example/.../private.properties 0.5 kB
- Case10445Example/.../project.properties 4 kB
- Case10445Example/nbproject/project.xml 2 kB
- Case10445Example/src/conf/MANIFEST.MF 0.0 kB
- Case10445Example/src/.../example/Menu.java 2 kB
- Case10445Example/src/.../TestBean.java 2 kB
- Case10445Example/web/.../context.xml 0.1 kB
- Case10445Example/web/WEB-INF/web.xml 2 kB
- Case10445Example/.../welcomeICEfaces.xhtml 1 kB
-
Hide
- Case10445Example.war
- 7.38 MB
- Arran Mccullough
-
- META-INF/MANIFEST.MF 0.1 kB
- META-INF/context.xml 0.1 kB
- WEB-INF/classes/com/.../example/Menu.class 3 kB
- WEB-INF/classes/.../example/TestBean.class 3 kB
- WEB-INF/lib/commons-beanutils.jar 226 kB
- WEB-INF/lib/commons-collections.jar 558 kB
- WEB-INF/lib/commons-digester.jar 140 kB
- WEB-INF/lib/commons-logging.jar 52 kB
- WEB-INF/lib/icefaces-ace.jar 1.42 MB
- WEB-INF/lib/icefaces-compat.jar 2.29 MB
- WEB-INF/lib/icefaces.jar 237 kB
- WEB-INF/lib/javax.faces.jar 2.48 MB
- WEB-INF/web.xml 2 kB
- welcomeICEfaces.xhtml 1 kB
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Add poc changes to re-create issue - adding an ace:menubar to screen1.
This has been fixed by a preliminary generator change related to ICE-7321. The new approach will be improved, but the basic idea seems to fix this particular problem.
Still seeing this issue in the latest POC code and the 1Line app code.
To reproduce on POC:
- Load app and add Screen 1 to first tab.
- This should load a single menuItem in the top of the page labeled "Print"
- Clicking on this link should have the same action as the Print Preview button.
- Clicking on the menu doesn't have any action but clicking on the button works fine.
I wasn't seeing this issue before, but I committed a fix to solve the menu problems in a different way than using generic state-saving ids, and also updated the poc, and all menu issues seem to be fixed, including this one.
This issue is still open and not working correctly in the POC.
Attaching a much more isolated test case. The page consists of two forms each with a menuBar component that displays one menuItem. Each menu is linked to a different backing bean. The second menuItem action does not get fired.
this issue is now fixed by a modification in the form-lookup mechanism in ice.ace.AjaxRequest
Art made the following comment:
I think that the 'form:first' string is a jQuery selector, not an id ( http://api.jquery.com/first-selector/ ).
What line 148 is trying to do is just to find the containing form of the component, using jQuery calls.
var form = $(ice.ace.escapeClientId(cfg.source)).parents('form:first');
I think we could just use our own formOf() function instead, but before that, the menu items have to be rendered with client ids.