简体   繁体   English

是否可以在jsf项目中使用js库

[英]is it possible to use js library in a jsf project

I want to use a javascript library in a java web application, and I am wondering, is this possible in a jsf application (eg Ice Faces, or Prime Faces??). 我想在java web应用程序中使用javascript库,我想知道,这是否可能在jsf应用程序中(例如Ice Faces,或Prime Faces ??)。

Are there any rules to be followed while integrating use of a js library in a jsf project? 在jsf项目中集成js库的使用时是否有任何规则要遵循? What should I keep in mind and how do I do this? 我应该记住什么,我该怎么做?

There is just one JSF Framework and latest version is 2.1, and is not bundled natively with js framework. 只有一个JSF框架,最新版本是2.1,并没有与js框架本地捆绑。 Remember that JSF and any other web framework like Struts or Spring mission is to help in the development cycle by providing a mature MVC framework, but beyond that, it is a pure Java Web Application. 请记住,JSF和Struts或Spring任务等任何其他Web框架都是通过提供成熟的MVC框架来帮助开发周期,但除此之外,它还是一个纯Java Web应用程序。

As any Web Application, you can add any JavaScript framework you need to work with (like extjs ). 与任何Web应用程序一样,您可以添加需要使用的任何JavaScript框架(如extjs )。 Specifically in JSF, there are tag component frameworks you can add that comes with ajax functionality like RichFaces and PrimeFaces both of them come with jQuery and you should check the shipped version before try to add your own jQuery version. 特别是在JSF中,你可以添加一些标签组件框架,它们带有像RichFacesPrimeFaces这样的ajax功能,它们都带有jQuery,你应该在尝试添加自己的jQuery版本之前检查发布的版本。

You can, and in fact some JSF frameworks ship with a JS library. 你可以,事实上一些JSF框架附带一个JS库。 I think Ice Faces ships with jQuery for example. 我认为Ice Faces附带了jQuery。 While it may be possible, you have to be very careful since JSF frameworks like to manage the DOM themselves. 尽管有可能,但您必须非常小心,因为JSF框架喜欢自己管理DOM。

So, yes you can but I would strongly advise against it unless you are very careful and avoid manipulating the DOM in a way that your framework doesn't expect. 所以,是的,你可以,但我强烈建议反对它,除非你非常小心,避免以你的框架不期望的方式操纵DOM。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM