1、rich:fileUpload 3.X支持a4j:support,可以通过a4j:support配置onclear、onuploadcomplete事件
rich:fileUpload 4.X支持a4j:ajax,不支持a4j:support
2、rich:fileUpload 3.X刷新 是reRender
rich:fileUpload 4.X刷新是render
3、rich:fileUpload 4.5 不支持IE9浏览器,支持IE10及以上浏览器。
代码示例如下:
在rich:fileUpload 3.X中写法是:
<h:form id="form064af277-0f55-4700-b3f3-55b787dc7ae8" width="480">
<rich:fileUpload id="codeae9d0c56-756f-41a1-b548-901b7a99020c"
value="#{ABean.value}" required="false"
fileUploadListener="#{ABean.uploadlistener}"
maxFilesQuantity="#{ABean.maxfile}" allowFlash="false"
immediateUpload="true" addControlLabel="添加文件..." listHeight="80">
<a4j:support id="supportcode287c9790-06cb-4e23-b0f5-5c2658fd1f95"
event="onuploadcomplete" reRender="codeac8069bc-2ff3-46d1-8164-
a3f00e555f87">
</a4j:support>
<a4j:support id="supportcode481b7a18-2334-49d5-a48c-dba78e9a423b"
event="onclear"
action="#{ABean.uploadclean}" reRender="codeae9d0c56-756f-41a1-b548-
901b7a99020c"></a4j:support>
</rich:fileUpload>
</h:form>
在 在rich:fileUpload 4.X中的写法是:
<h:form id="form064af277-0f55-4700-b3f3-55b787dc7ae8" width="480">
<rich:fileUpload id="fileupload"
fileUploadListener="#{ABean.Upload}"
maxFilesQuantity="#{ABean.max}"
acceptedTypes="jpg,png,jpeg,mp3,mp4,avi,flv,wsf,doc,docx,pdf,xls,xlsx,txt"
ontyperejected="alert('只允许上传后缀为 jpg,png,jpeg,mp3,mp4,avi,flv,wsf,doc,docx,pdf,xls,xlsx,txt的文件!');"
render="fspMsgPanel,confirmPanel" required="false"
uploadLabel="上传" addLabel="添加">
<a4j:ajax event="clear" listener="#{ABean.uploadclean}"
render="fileupload" oncomplete="stopProgress()"/>
<a4j:ajax event="uploadcomplete" execute="@none" render="fileupload" />
</rich:fileUpload>
</h:form>
a4j:ajax的属性列表如下:
Name | Required | Type | Description |
---|---|---|---|
bypassUpdates | false | javax.el.ValueExpression (must evaluate to boolean ) | If "true", after process validations phase it skips updates of model beans on a force render response. It can be used for validating components input |
data | false | javax.el.ValueExpression (must evaluate to java.lang.Object ) | Serialized (on default with JSON) data passed to the client by a developer on an AJAX request. It's accessible via "event.data" syntax. Both primitive types and complex types such as arrays and collections can be serialized and used with data |
disabled | false | javax.el.ValueExpression (must evaluate to boolean ) | If "true", do not initiate an ajax request when the associated event is observed |
event | false | javax.el.ValueExpression (must evaluate to java.lang.String ) | Name of JavaScript event property (click, change, etc.) of parent component that triggers the behavior. If the event attribute is not defined, the behavior is triggered on the event that normally provides interaction behavior for the parent component. The value cannot be an EL expression. |
execute | false | javax.el.ValueExpression (must evaluate to java.lang.Object ) | Ids of components that will participate in the "execute" portion of the Request Processing Lifecycle. Can be a single id, a space or comma separated list of Id's, or an EL Expression evaluating to an array or Collection. Any of the keywords "@this", "@form", "@all", "@none", "@region" may be specified in the identifier list. Some components make use of additional keywords. Default value is "@region" which resolves to parent component if no region is present. |
immediate | false | javax.el.ValueExpression (must evaluate to boolean ) | Flag indicating that, if this component is activated by the user, notifications should be delivered to interested listeners and actions immediately (that is, during Apply Request Values phase) rather than waiting until Invoke Application phase. |
limitRender | false | javax.el.ValueExpression (must evaluate to boolean ) | If "true", render only those ids specified in the "render" attribute, forgoing the render of the auto-rendered panels |
listener | false | javax.el.ValueExpression (must evaluate to javax.el.MethodExpression ) | Method expression referencing a method that will be called when an AjaxBehaviorEvent has been broadcast for the listener. |
onbeforedomupdate | false | javax.el.ValueExpression (must evaluate to java.lang.String ) | The client-side script method to be called after the ajax response comes back, but before the DOM is updated |
onbeforesubmit | false | javax.el.ValueExpression (must evaluate to java.lang.String ) | The client-side script method to be called before the AJAX request is submitted |
onbegin | false | javax.el.ValueExpression (must evaluate to java.lang.String ) | The client-side script method to be called before an ajax request. |
oncomplete | false | javax.el.ValueExpression (must evaluate to java.lang.String ) | The client-side script method to be called after the DOM is updated |
onerror | false | javax.el.ValueExpression (must evaluate to java.lang.String ) | The client-side script method to be called when an error has occurred during Ajax communications |
queueId | false | javax.el.ValueExpression (must evaluate to java.lang.String ) | Identify the name of the destination queue |
render | false | javax.el.ValueExpression (must evaluate to java.lang.Object ) | Ids of components that will participate in the "render" portion of the Request Processing Lifecycle. Can be a single id, a space or comma separated list of Id's, or an EL Expression evaluating to an array or Collection. Any of the keywords "@this", "@form", "@all", "@none", "@region" may be specified in the identifier list. Some components make use of additional keywords |
resetValues | false | javax.el.ValueExpression (must evaluate to boolean ) | If true, indicate that this particular Ajax transaction is a value reset transaction. This will cause resetValue() to be called on any EditableValueHolder instances encountered as a result of this ajax transaction. If not specified, or the value is false, no such indication is made. |
status | false | javax.el.ValueExpression (must evaluate to java.lang.String ) | Name of the request status component that will indicate the status of the Ajax request |
转载请注明出处:https://blog.csdn.net/tongtong_use/article/details/84344269