Problem using Richfaces 3.3.4 fileUpload - onuploadcomplete not executed if rendered is false
rossolfr Oct 11, 2013 11:05 AMHello Community,
i have a strange problem using fileUpload.
i have a boolean value uploadNeeded in my managed bean which can be set using a selectBooleanCheckbox.
if the upload listener updates uploadNeeded the onuploadcomplete doesn't get executed.
<h:form> <a4j:log level="ALL" popup="true" /> <t:div id="wrapper"> <h:outputText value="timestamp = #{utilViewBean.timeStamp}" /> <t:div> <rich:fileUpload fileUploadListener="#{utilService.testUploadListener}" immediateUpload="true" autoclear="true" acceptedTypes="jpg, jpeg, tif, tiff, pdf" maxFilesQuantity="1" addControlLabel="Add" height="60px" rendered="#{utilService.uploadNeeded}"> <a4j:support event="onuploadcomplete" reRender="wrapper" /> </rich:fileUpload> </t:div> </t:div> </h:form> <h:form> <h:selectBooleanCheckbox value="#{utilService.uploadNeeded}" > <a4j:support event="onclick" reRender="wrapper" /> </h:selectBooleanCheckbox> </h:form>
snip from utilService
public boolean isUploadNeeded() { return uploadNeeded; } public void setUploadNeeded(boolean uploadNeeded) { this.uploadNeeded = uploadNeeded; } public void testUploadListener(UploadEvent event) throws Exception { UploadItem item = event.getUploadItem(); try { if (item != null) { setUploadNeeded(false); } } catch (Exception e) { log.error(e.toString()); log.trace(e.toString(),e); } }
next the output of a4j:log after file is uploaded.
debug[16:53:51,325]: Query preparation for form 'j_id123' requested debug[16:53:51,325]: Append file control j_id123:j_id127:file with value [einreichung_deckblatt.pdf] and value attribute [null] debug[16:53:51,326]: Append file control j_id123:j_id127:file with value [] and value attribute [null] debug[16:53:51,326]: Append hidden control j_id123_SUBMIT with value [1] and value attribute [1] debug[16:53:51,326]: Append hidden control javax.faces.ViewState with value [fcxml05BhD8vZjD+n4ueYM1IRRA8IPZoz/h99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu/qqXEc=] and value attribute [fcxml05BhD8vZjD+n4ueYM1IRRA8IPZoz/h99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu/qqXEc=] debug[16:53:51,326]: parameter j_id123:j_id127 with value j_id123:j_id127 debug[16:53:51,326]: parameter ajaxSingle with value j_id123:j_id127 debug[16:53:51,326]: parameter _richfaces_upload_uid with value 0.8452524906906649 debug[16:53:51,326]: parameter _richfaces_file_upload_action with value progress debug[16:53:51,326]: Look up queue with default name debug[16:53:51,327]: NEW AJAX REQUEST !!! with form: j_id123 debug[16:53:51,327]: Start XmlHttpRequest debug[16:53:51,327]: Request state : 1 debug[16:53:51,327]: QueryString: AJAXREQUEST=_viewRoot&j_id123%3Aj_id127%3Afile=einreichung_deckblatt.pdf&j_id123%3Aj_id127%3Afile=&j_id123_SUBMIT=1&javax.faces.ViewState=fcxml05BhD8vZjD%2Bn4ueYM1IRRA8IPZoz%2Fh99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu%2FqqXEc%3D&j_id123%3Aj_id127=j_id123%3Aj_id127&ajaxSingle=j_id123%3Aj_id127&_richfaces_upload_uid=0.8452524906906649&_richfaces_file_upload_action=progress& debug[16:53:51,812]: Request state : 2 debug[16:53:51,814]: Request state : 3 debug[16:53:51,815]: Request state : 3 debug[16:53:51,815]: Request state : 4 debug[16:53:51,815]: Request end with state 4 debug[16:53:51,816]: Response with content-type: text/xml;charset=UTF-8 debug[16:53:51,816]: Full response content: <?xml version="1.0"?> <html lang="de" xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link class="component" href="/eHealthPortal/faces/a4j/s/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" /><link class="component" href="/eHealthPortal/faces/a4j/s/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/scripts/utils.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/scripts/json/json-dom.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/js/FileUpload.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/js/swfobject.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/js/progressBar.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/ajax4jsf/javascript/scripts/form.js" type="text/javascript"> </script><link class="component" href="/eHealthPortal/faces/a4j/s/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/css/fileUpload.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" /><link class="component" href="/eHealthPortal/faces/a4j/s/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/css/progressBar.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" /><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/scripts/skinning.js" type="text/javascript"> </script></head><body><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="fcxml05BhD8vZjD+n4ueYM1IRRA8IPZoz/h99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu/qqXEc=" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><span id="_ajax:data"></span><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="fcxml05BhD8vZjD+n4ueYM1IRRA8IPZoz/h99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu/qqXEc=" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><span id="_ajax:data"></span><!-- MYFACES JAVASCRIPT --> </body></html> debug[16:53:51,816]: Header Ajax-Expired not found, search in <meta> debug[16:53:51,816]: search for elements by name 'meta' in element #document debug[16:53:51,817]: Find <meta name='Ajax-Update-Ids' content=''> debug[16:53:51,818]: Find <meta name='Ajax-Response' content='true'> debug[16:53:51,818]: Find <meta name='Ajax-Update-Ids' content=''> debug[16:53:51,818]: Find <meta name='Ajax-Response' content='true'> debug[16:53:51,818]: call getElementById for id= _ajax:data error[16:53:51,818]: Error on parsing JSON data syntax error debug[16:53:51,818]: Call local onbeforedomupdate function before replacing elemements debug[16:53:51,819]: Header Ajax-Update-Ids not found, search in <meta> debug[16:53:51,819]: search for elements by name 'meta' in element #document debug[16:53:51,820]: Find <meta name='Ajax-Update-Ids' content=''> warn[16:53:51,820]: No information in response about elements to replace debug[16:53:51,821]: call getElementById for id= org.ajax4jsf.oncomplete debug[16:53:51,821]: Processing updates finished, no oncomplete function to call debug[16:53:51,821]: call getElementById for id= ajax-view-state debug[16:53:51,821]: Hidden JSF state fields: [object HTMLSpanElement] debug[16:53:51,821]: Namespace for hidden view-state input fields is undefined debug[16:53:51,821]: search for elements by name 'input' in element span debug[16:53:51,823]: Replace value for inputs: 13 by new values: 1 debug[16:53:51,823]: Input in response: javax.faces.ViewState debug[16:53:51,823]: Found same input on page with type: hidden debug[16:53:51,823]: Found same input on page with type: hidden debug[16:53:51,823]: Found same input on page with type: hidden debug[16:53:51,823]: Found same input on page with type: hidden debug[16:53:51,823]: Found same input on page with type: hidden debug[16:53:51,823]: search for elements by name 'INPUT' in element span debug[16:53:51,824]: Replace value for inputs: 13 by new values: 0 debug[16:53:51,824]: call getElementById for id= _A4J.AJAX.focus debug[16:53:51,824]: No focus information in response debug[16:53:51,990]: Have Event [object Object] with properties: target: [object HTMLDivElement], srcElement: undefined, type: dataavailable debug[16:53:51,990]: Query preparation for form 'j_id123' requested debug[16:53:51,990]: Append file control j_id123:j_id127:file with value [] and value attribute [null] debug[16:53:51,990]: Append hidden control j_id123_SUBMIT with value [1] and value attribute [1] debug[16:53:51,990]: Append hidden control javax.faces.ViewState with value [fcxml05BhD8vZjD+n4ueYM1IRRA8IPZoz/h99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu/qqXEc=] and value attribute [fcxml05BhD8vZjD+n4ueYM1IRRA8IPZoz/h99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu/qqXEc=] debug[16:53:51,990]: parameter j_id123:j_id128 with value j_id123:j_id128 debug[16:53:51,990]: Look up queue with default name debug[16:53:51,990]: NEW AJAX REQUEST !!! with form: j_id123 debug[16:53:51,991]: Start XmlHttpRequest debug[16:53:51,991]: Request state : 1 debug[16:53:51,991]: QueryString: AJAXREQUEST=_viewRoot&j_id123%3Aj_id127%3Afile=&j_id123_SUBMIT=1&javax.faces.ViewState=fcxml05BhD8vZjD%2Bn4ueYM1IRRA8IPZoz%2Fh99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu%2FqqXEc%3D&j_id123%3Aj_id128=j_id123%3Aj_id128& debug[16:53:52,590]: Request state : 2 debug[16:53:52,591]: Request state : 3 debug[16:53:52,592]: Request state : 3 debug[16:53:52,592]: Request state : 4 debug[16:53:52,592]: Request end with state 4 debug[16:53:52,592]: Response with content-type: text/xml;charset=UTF-8 debug[16:53:52,592]: Full response content: <?xml version="1.0"?> <html lang="de" xmlns="http://www.w3.org/1999/xhtml"><head><title></title><link class="component" href="/eHealthPortal/faces/a4j/s/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" /><link class="component" href="/eHealthPortal/faces/a4j/s/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg.ajax4jsf.javascript.PrototypeScript" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/scripts/utils.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/scripts/json/json-dom.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/js/FileUpload.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/js/swfobject.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/js/progressBar.js" type="text/javascript"> </script><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/ajax4jsf/javascript/scripts/form.js" type="text/javascript"> </script><link class="component" href="/eHealthPortal/faces/a4j/s/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/css/fileUpload.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" /><link class="component" href="/eHealthPortal/faces/a4j/s/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/css/progressBar.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" /><script src="/eHealthPortal/faces/a4j/g/3_3_4-SNAPSHOTorg/richfaces/renderkit/html/scripts/skinning.js" type="text/javascript"> </script></head><body><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="fcxml05BhD8vZjD+n4ueYM1IRRA8IPZoz/h99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu/qqXEc=" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state"><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="fcxml05BhD8vZjD+n4ueYM1IRRA8IPZoz/h99y1p8XPbKjoW1UiYR9WNIs2E0xX97JFDENJoNtUpeVj0JtCr0YPigEYyJIHWC0UGu/qqXEc=" /></span><meta id="Ajax-Response" name="Ajax-Response" content="true" /><!-- MYFACES JAVASCRIPT --> </body></html> debug[16:53:52,592]: Header Ajax-Expired not found, search in <meta> debug[16:53:52,592]: search for elements by name 'meta' in element #document debug[16:53:52,594]: Find <meta name='Ajax-Update-Ids' content=''> debug[16:53:52,594]: Find <meta name='Ajax-Response' content='true'> debug[16:53:52,594]: Find <meta name='Ajax-Update-Ids' content=''> debug[16:53:52,594]: Find <meta name='Ajax-Response' content='true'> debug[16:53:52,594]: Header Ajax-Update-Ids not found, search in <meta> debug[16:53:52,594]: search for elements by name 'meta' in element #document debug[16:53:52,595]: Find <meta name='Ajax-Update-Ids' content=''> warn[16:53:52,595]: No information in response about elements to replace debug[16:53:52,595]: call getElementById for id= org.ajax4jsf.oncomplete debug[16:53:52,595]: Processing updates finished, no oncomplete function to call debug[16:53:52,595]: call getElementById for id= ajax-view-state debug[16:53:52,595]: Hidden JSF state fields: [object HTMLSpanElement] debug[16:53:52,595]: Namespace for hidden view-state input fields is undefined debug[16:53:52,595]: search for elements by name 'input' in element span debug[16:53:52,596]: Replace value for inputs: 12 by new values: 1 debug[16:53:52,596]: Input in response: javax.faces.ViewState debug[16:53:52,596]: Found same input on page with type: hidden debug[16:53:52,596]: Found same input on page with type: hidden debug[16:53:52,596]: Found same input on page with type: hidden debug[16:53:52,596]: Found same input on page with type: hidden debug[16:53:52,596]: Found same input on page with type: hidden debug[16:53:52,597]: search for elements by name 'INPUT' in element span debug[16:53:52,597]: Replace value for inputs: 12 by new values: 0 debug[16:53:52,598]: call getElementById for id= _A4J.AJAX.focus debug[16:53:52,598]: No focus information in response
upload dialog looks like this
Any suggestions what i do wrong?