File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Spring Book Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Book Question" Watch "Spring Book Question" New topic
Author

Spring Book Question

joei salijado
Greenhorn

Joined: Sep 23, 2009
Posts: 11
Hi Craig,

Is it easy to integrate JQuery with Spring App? The app that we are working on recently needs some overhaul and the user wanted to add more 'wow' factor.

Is this discussed in some manner with your book?

Thanks!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9521
    
    2

jQuery is a Javascript framework and Spring is an application framework. I hope by integration you meant using jQuery for your existing Spring based application. Any applicaion that has HTML for rendering can benefit from jQuery. It does not have to be built with Spring.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
joei salijado
Greenhorn

Joined: Sep 23, 2009
Posts: 11
Hi Joe,

I agree on all of the things you mentioned.
I think I did not elaborate much on my question..

For simple DOM manipulation, then I could do that with Jquery alone but I specifically wanted to know how Spring handles AJAX support and how to specifically connect the Spring Controllers to Jquery calls.

If this is discussed on some manner on this book then I would be very interested to have a copy of it.

I need to know how to integrate the backend framework with frontend GUI.


Thanks!
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

This might be a useful read about AJAX simplification in Spring 3.0


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9521
    
    2

joei salijado wrote:Hi Joe,

I agree on all of the things you mentioned.
I think I did not elaborate much on my question..

For simple DOM manipulation, then I could do that with Jquery alone but I specifically wanted to know how Spring handles AJAX support and how to specifically connect the Spring Controllers to Jquery calls.

If this is discussed on some manner on this book then I would be very interested to have a copy of it.

I need to know how to integrate the backend framework with frontend GUI.


Thanks!


I use Struts backed by Spring. I never had to bother about integrating jQuery with either of them apart from the just very fact that jQuery ajax calls should be made to a specific action class inside a namespace. The rest of all what we do is just DOM manipulation and has got nothing to do with the backend.
Craig Walls
author
Ranch Hand

Joined: Sep 19, 2003
Posts: 335
    
    5

The link mentioned by Vijitha Kumara above was the first thing that came to mind when reading your question.

In short, Spring MVC controllers have traditionally been used to produce HTML output, but improvements introduced in Spring 3.0 make it even easier to write controllers that serve content in whatever format the client wants. But even then that's probably not how you should look at it...

Thinking with a RESTful mindset, controllers should serve *resources*. A resource is a *thing*...an Order, a Product, an Employee...some noun in your application. The resource that the controller serves and how it's represented are separate matters. Depending on how it's developed, the controller either returns the resource object or puts the resource into the model, but plays no direct role in deciding how it should be represented. A view resolver will decide how it's represented. Or you can use the @ResponseBody annotation along with message converters to help convert that object into XML, JSON, or whatever representation the client is asking for.

So, once the representation is settled, it is returned to the caller...whoever that may be. The caller could be another Spring application using RestTemplate to retrieve the resource. Or it could be a web browser. Or it could be some JQuery-enabled JavaScript. My point is that you don't really "hook" JQuery into Spring--but you can use JQuery to consume a resource, represented as JSON and served by a Spring MVC controller.


Spring in Action - Unleash POJO power in your applications!
Modular Java - Discover the secret weapon to modularity on the Java platform!
XDoclet in Action - Your complete guide to code generation with XDoclet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring Book Question