无需修改JAR即可在primefaces.jar中升级jquery.js [英] Upgrading jquery.js in primefaces.jar without modifying the JAR
问题描述
我正在使用Primefaces 3.1,并且在使用的jquery.js中发现了一个错误(对该错误进行了描述并在此处修复:
I am working with Primefaces 3.1 and I found a bug in the jquery.js used (the bug is described and fix here: http://forum.jquery.com/topic/datepicker-doesn-t-work-inside-fixed-div). I am wondering if there is an elegant way for replacing the .js?
无法直接在jar中进行替换,因为我们正在使用Maven,并且我不想自定义库.
The replacement directly in the jar cannot be done because we are using Maven and I don't want to customise a library.
当前,我替换了HeadRenderer以便从标题中删除jquery.js,并添加了自己的js文件,但是也许有Primefaces内置选项可以做到这一点?
Currently, I replaced the HeadRenderer to remove the jquery.js from the header and I added my own js file, but there's maybe a Primefaces built-in option to do the same?
推荐答案
只需将所需的jquery.js
文件放入您自己的webapp项目中,该项目的资源标识符与PrimeFaces用于其捆绑的jQuery:primefaces:jquery/jquery.js
相同.具有相同标识符的Webapp自身资源的加载优先级高于JAR中的资源.
Just put the desired jquery.js
file in your own webapp project with the same resource identifier as PrimeFaces is using for its bundled jQuery: primefaces:jquery/jquery.js
. Webapp's own resources with the same identifier have loading precedence over those in JARs.
因此,这里:
WebContent
|-- META-INF
|-- WEB-INF
|-- resources
| |-- primefaces
| | `-- jquery
| | `-- jquery.js
: :
或者,只需升级PrimeFaces本身. 3.1还是很古老的.
Alternatively, just upgrade PrimeFaces itself. 3.1 is quite ancient anyway.
这篇关于无需修改JAR即可在primefaces.jar中升级jquery.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!