rich:fileUpload 3.X 与rich:fileUpload 4.x中的区别

本文详细对比了RichFaces不同版本的FileUpload组件特性,包括事件支持、刷新方式及浏览器兼容性。提供了3.X与4.X版本的代码示例,展示了如何使用a4j:support和a4j:ajax进行事件监听与页面更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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的属性列表如下:

Attributes 
NameRequiredTypeDescription
bypassUpdatesfalsejavax.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
datafalsejavax.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
disabledfalsejavax.el.ValueExpression 
(must evaluate to boolean)
If "true", do not initiate an ajax request when the associated event is observed
eventfalsejavax.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.
executefalsejavax.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.
immediatefalsejavax.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.
limitRenderfalsejavax.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
listenerfalsejavax.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.
onbeforedomupdatefalsejavax.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
onbeforesubmitfalsejavax.el.ValueExpression 
(must evaluate to java.lang.String)
The client-side script method to be called before the AJAX request is submitted
onbeginfalsejavax.el.ValueExpression 
(must evaluate to java.lang.String)
The client-side script method to be called before an ajax request.
oncompletefalsejavax.el.ValueExpression 
(must evaluate to java.lang.String)
The client-side script method to be called after the DOM is updated
onerrorfalsejavax.el.ValueExpression 
(must evaluate to java.lang.String)
The client-side script method to be called when an error has occurred during Ajax communications
queueIdfalsejavax.el.ValueExpression 
(must evaluate to java.lang.String)
Identify the name of the destination queue
renderfalsejavax.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
resetValuesfalsejavax.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.
statusfalsejavax.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

目 录 摘 要 I ABSTRACT II 第一章 绪论 1 1.1 选题的背景 1 1.2 国内外状况 2 1.3 问题的提出 3 1.4 主要研究内容 3 1.5 论文的组织结构 3 第二章 相关理论及技术介绍 5 2.1 开发平台 5 2.1.1 MyEclipse 5 2.1.2 NetBeans 5 2.2 相关技术 5 2.2.1 XML 5 2.2.2 Dom4j 6 2.2.3 SOAP 6 2.2.4 WebService 7 2.2.5 WSDL 7 2.2.6 Velocity 8 2.2.7 Swing 8 2.2.8 Java反射 9 2.3 本章小结 9 第三章 服务开发平台的总体框架 10 3.1 前台可视化IDE的设计 11 3.2 后台的总体设计 12 3.2.1 后台RuntimeContainer容器管理模块设计概述 13 3.2.2 后台UDDI注册中心模块设计概述 14 3.2.3 后台SP Agent Builder代码生成模块设计概述 16 3.3 本章小结 20 第四章 服务生成工具SP Agent Builder的设计与实现 21 4.1 三层XML schema设计与解析模块的设计与实现 21 4.1.1 功能层XML schema的设计 21 4.1.2 表示层XML schema 的设计 24 4.1.3 传输层XML schema 的设计 24 4.1.4 三层XML文件解析的设计与实现 26 4.2 数据转换模块的设计与实现 28 4.2.1 目标数据格式介绍 28 4.2.2 对象与目标数据格式之间的转换 31 4.3 传输代理模块的设计与实现 35 4.3.1 网络传输协议 36 4.3.2 传输代理的运作流程 38 4.4 代码生成器模块的设计与实现 39 4.4.1 模板的设计 39 4.4.2 代码生成的运作流程 40 4.5 可视化编辑器模块的设计与实现 41 4.5.1 可视化编辑器的设计 41 4.5.2 可视化编辑器的运作流程 42 4.5 本章小结 42 第五章 系统实现 44 4.1 创建服务 44 4.2 编辑服务 48 4.3 删除服务 50 4.4 本章小结 51 第六章 结论 52 致 谢 53 参考文献 54 毕业设计小结 56 附录A XML数据类型和Java数据类型之间的映射规则 57 附录B 功能层XML schema的设计 58 附录C 表示层XML schema的设计 60 附录D 传输层XML schema的设计 61 附录E TXT文本的格式介绍 63
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值