Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery and MVC Java frameworks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery and MVC Java frameworks" Watch "jQuery and MVC Java frameworks" New topic
Author

jQuery and MVC Java frameworks

Rafael Rodrigues
Greenhorn

Joined: Nov 06, 2007
Posts: 2
Since I know about the existence of jQuery (about 3 years ago), many Java frameworks for web development have jQuery integrated in its implementation. Examples are Struts-jquery library, RichFaces and PrimeFaces, wich are Java web frameworks to work with server and client-side componentes to develop web apps.

Sometimes we have to include jQuery javascript file with a version higher than that provided with this frameworks to use new features of jQuery or jQuery plugins that works only on most recent versions of jQuery. A tipical problem that occurs is the funcionalities that was working before include jQuery JS doesn't work anymore. Than, we have to search for solutions on forums like stackoverflow or in the official forum of the framework for workaround solutions.

There's an easy solution to workaround this kind of situation? Or it depends on the framework I use and how it was developed?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61318
    
  66

It's well known that I'm not a huge fan of most frameworks, and this is just one of the reasons.

That said, remember that in the end, all that ends up at the browser is an HTML page. So you can -- if you wish -- ignore the framework integration completely and just code to whatever HTML ends up at the browser. That means that you need to figure out whatever the framework is going to create as far as HTML is concerned from the server-side markup. That's perhaps just as much a pain.

Frameworks that are intensely invasive into the client-side markup tend to be my least favorite.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rafael Rodrigues
Greenhorn

Joined: Nov 06, 2007
Posts: 2
Yes, Bear, I know about these details, that in the end everything ends up in HTML and Javascript code. I generally test some Javascript functionalities in plain HTML code before use them together with the framework componentes. This helps me isolate some problems I have with some jQuery plugins or plain Javascript functions. What you said about a pain to consider what the framework will show when rendering HTML + Javascript is pure true.

I was talking at how to, for example, ignore (or override) the jQuery library that comes with RichFaces (for example) with my own import of jQuery library on a simple manner. It's not a problem I'm facing with these days, but I'm afraid to face it with another frameworks I never worked with. I searched a little about jQuery.noConflict() and I think it could help me on this case, but I never used it.
Keith Wood
Author
Ranch Hand

Joined: Aug 28, 2012
Posts: 38

The principle behind the noConflict function is to return the $ variable to its original value, i.e. prior to loading jQuery. This can be used with multiple versions of jQuery itself. The process would load the first version of jQuery and then any plugins that rely upon it. Next load the second version of jQuery and any plugins that require it. Then call noConflict to return $ to the first version and to assign a new variable to refer to the second version. Thereafter use the variables jQuery and the new one to refer to the different versions. Something like this:



Author of the upcoming "Extending jQuery" book from Manning.
 
GeeCON Prague 2014
 
subject: jQuery and MVC Java frameworks