File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jQuery and MVC Java frameworks

 
Rafael Rodrigues
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rafael Rodrigues
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 38
jQuery
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic