Results 1 to 8 of 8

Thread: spring json, ajax, jquery

  1. #1

    Default spring json, ajax, jquery

    Hello... I want to use Ajax and jquery in my project. I am using Spring JSON library in my Spring MVC project... Can anybody help to give a quick start to this???? May be some tutorial, article, demo application...

  2. #2
    Join Date
    Mar 2010
    Location
    Boston, MA
    Posts
    316

  3. #3

    Default

    I have checked the springsource site u gave,... even checked out the sample project from there svn.... but it seems to have some errors in it.... Any link/site wherein i can find a very basic tutorial to start of with....

  4. #4
    Join Date
    Mar 2010
    Location
    Boston, MA
    Posts
    316

    Default

    The second link i gave you is the direct link to a working WAR file. If you are unable to compile/deploy the source from springsource's respository then use the WAR file, deploy it on an app server, attach the java source and start walking through the application.

  5. #5
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    709

    Default

    If you're going to use heavy ajax I suggest you take a look at DWR.
    With DWR 3 and Spring 3 you get an incredible integration, and, with a few lines of configuration, you can annotate dwr services much like you annotate controllers, and can accomplish amazing things with very little effort. Take a look at this.
    Configuration is very straightforward, but, should you need help, I can post my configuration which works perfectly.

    Best regards,

    Enrico

  6. #6

    Default

    Hey thanks Enrico.... But I am using Spring Json.. Is it not that useful in this scenario???? If you could help me in that...

  7. #7
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    709

    Default

    Hi,

    before I switched to DWR, I also used Spring Json, with prototype and behaviour as client side javascript libraries to control ajax requests. I'm not saying it's a bad approach, it is a nice one since you just add data to your Model object in the controller and the Spring Json view translates it into json response for your ajax call.

    BUT DWR is something different and, from my point of view, far, far better in the sense that it also includes easy handling of the client part. To explain it better, with Spring Json you get out-of the-box encoding of data into json strings, but then on your page what you get is a json string and you have to manually handle it to transform it into the data you need to show/process. Even if there are javascript framework that help you do that easily (jquery, prototype, behaviour etc.) you still need to do something manually for every ajax request you must handle.

    With DWR, you get to USE java objects and methods in your javascript directly, because DWR takes care in the background of everything that is involved in ajax request processing: marshalling, unmarshalling, transforming from json and to json, escaping characters, handling errors etc. With DWR you will never ever have a "new Ajax.request" line in your code, just take a look at the examples.

    I've happily used DWR for some time now and I find it amazing, I'm not saying it's the only way to go, just that it's an option worth considering if you're going to use heavy ajax in your app.

    Hope I was clear enough, and helpful.

    Enrico

  8. #8

    Default

    Thnaks once again Enrico.. Things r a bit clear to me... I will try the examples... and get back to u if i need any help...

    Thanks Maheshguruswammy for the reply too

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •