Details
Description
When using the patched Mojarra 2.1.3 jar it is not possible to clear out a non-ajax enabled h:inputText field. With the regular Mojarra 2.1.3 jar this is possible with the same code.
My test also shows and issue with an ajax enabled input field not being cleared. Its possible that this is an issue with the patched jar and the code that is being called to clear/reset all input fields on the form.
-
Hide
- Case11742Example.war
- 9.60 MB
- Migration
-
- META-INF/MANIFEST.MF 0.1 kB
- META-INF/context.xml 0.1 kB
- WEB-INF/classes/com/.../example/Item.class 0.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-ee-ace.jar 3.13 MB
- WEB-INF/lib/icefaces-ee-compat.jar 2.68 MB
- WEB-INF/lib/icefaces-ee.jar 345 kB
- WEB-INF/lib/javax.faces.jar 2.48 MB
- WEB-INF/web.xml 2 kB
- welcomeICEfaces.xhtml 1 kB
-
- ICE-8731.patch
- 3 kB
- Migration
-
Hide
- javax.faces.jar
- 2.48 MB
- Migration
-
- META-INF/MANIFEST.MF 22 kB
- META-INF/error-include.xhtml 6 kB
- META-INF/facelet-dev-debug.xml 5 kB
- META-INF/facelet-dev-error.xml 5 kB
- META-INF/html_basic.tld 461 kB
- META-INF/jsf_core.tld 56 kB
- META-INF/mojarra-jsf-api-probe-provider.xml 3 kB
- META-INF/mojarra_ext.taglib.xml 3 kB
- META-INF/mojarra_ext.tld 5 kB
- META-INF/resources/.../jsf-uncompressed.js 109 kB
- META-INF/resources/javax.faces/jsf.js 30 kB
- META-INF/.../com.sun.faces.spi.injectionprovider 0.2 kB
- META-INF/.../javax.servlet.ServletContainerInitializer 0.0 kB
- com/sun/faces/LogStrings.properties 18 kB
- com/sun/faces/LogStrings_de.properties 20 kB
- com/sun/faces/LogStrings_es.properties 20 kB
- com/sun/faces/LogStrings_fr.properties 22 kB
- com/sun/faces/LogStrings_ja.properties 32 kB
- com/sun/faces/LogStrings_ko.properties 29 kB
- com/sun/.../LogStrings_pt_BR.properties 21 kB
- com/sun/.../LogStrings_zh_CN.properties 23 kB
- com/sun/.../LogStrings_zh_HK.properties 23 kB
- com/sun/.../LogStrings_zh_TW.properties 23 kB
- com/sun/faces/RIConstants.class 2 kB
- com/sun/faces/XMLSchema.dtd 18 kB
- com/sun/.../ActionListenerImpl.class 3 kB
- com/sun/.../ApplicationAssociate$1.class 0.8 kB
- com/sun/.../ApplicationAssociate.class 21 kB
- com/sun/.../ApplicationFactoryImpl.class 2 kB
- com/sun/.../ApplicationImpl$1.class 0.2 kB
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Attaching modified Mojarra 2.1.3 with both patches attached (jsf.js and UIComponentBase)
Attached the patched Mojarra 2.1.3 patch. The patch is based on the latest patch submitted under http://java.net/jira/browse/JAVASERVERFACES-2461 case.
Before getting into the issue we have with the patched Mojarra it should be noted that the test case needs to be modified first. The TestBean.clear method invoked when the "Clear" button is clicked doesn't really clear the bound values rendered by the input text components present in the page. The test page should be modified to use the TestBean.altClear method instead.
As near as I can figure at the moment, the problem does seem to exist in the patched version of jsf.js that we have in 2.1.3. In there is a clone attributes function that we modified. In that function, we altered how attributes are copied. Here is the section that deals with input style elements specifically:
var isInputElement = target.nodeName.toLowerCase() === 'input'; var propertyNames = isInputElement ? coreElementProperties.concat(inputElementProperties) : coreElementProperties; for (var iIndex = 0, iLength = propertyNames.length; iIndex < iLength; iIndex++) { var propertyName = propertyNames[iIndex]; var attributeName = propertyToAttribute(propertyName); if (sourceAttributeDetector(attributeName)) { var newValue = source[propertyName]; var oldValue = target[propertyName]; if (oldValue != newValue) { target[propertyName] = newValue; } } else if (targetAttributeDetector(attributeName)) { //setting property to '' seems to be the only cross-browser method for removing an attribute target[propertyName] = ''; } }
From my testing, I don't see either the sourceAttributeDetector() or targetAttributeDetector() conditions being satisfied which would mean the attribute never gets updated. This aligns with the fact that the response coming back from the server is correct in that the value has been cleared.
Since this code is similar to the code we passed to the Mojarra team for inclusion in JSF for 2.1.15, we should make sure we don't have the same problem there.
Attached test case to reproduce issue.
Another observation, if I set the value bound objects to null directly instead of the clear code, it still doesn't work with the patched jar. It does however work with the non-patched jar.
Assignee: Mircea Toma (was: Ken Fyten)
Re-opened and assigned to Mircea.