Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to use js library in a jsf project

Tags:

java

jsf

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??).

Are there any rules to be followed while integrating use of a js library in a jsf project? What should I keep in mind and how do I do this?

like image 681
Arvind Avatar asked Jan 17 '23 18:01

Arvind


2 Answers

There is just one JSF Framework and latest version is 2.1, and is not bundled natively with js framework. 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.

As any Web Application, you can add any JavaScript framework you need to work with (like 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.

like image 186
Luiggi Mendoza Avatar answered Jan 19 '23 09:01

Luiggi Mendoza


You can, and in fact some JSF frameworks ship with a JS library. I think Ice Faces ships with jQuery for example. While it may be possible, you have to be very careful since JSF frameworks like to manage the DOM themselves.

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.

like image 22
Andrew White Avatar answered Jan 19 '23 08:01

Andrew White