• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AJAX with Struts

 
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ppl,

Can anybody suggest me a good AJAX framework that I can use with an existing Struts application. Do we have a widely used framework specifically in regard with Struts.

Thanks in advance,
Muthu
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personally I almost always use jQuery or Prototype/Scriptaculous--I usually prefer using JavaScript libraries directly, because I'm a strong JavaScript programmer. There are quite a few other options, like Dojo, YUI, etc. There are also a number of Ajax tag libraries (just searching should bring up a couple of options) if you prefer that route.

If you're using Struts 2, it ships with some Ajax tags based on Dojo--but those tags have been deprecated for a few reasons and may never be updated to use a more recent version of Dojo. S2 is also getting a jQuery tag library, currently in the sandbox, but I don't know when it will be part of the official distribution.
 
Muthukrishnan Manoharan
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks David,

I am comfortable with jQuery. But was wondering whether people usually use some AJAX framework when dealing with Struts.

Muthu
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AJAX framework just make your life easy, it dosen't matter to it whether the back end action is file, a servlet or Struts action class. As long as your response is valid, you can use simple XMLHttpRequest object using JS or use AJAX framework..
 
Muthukrishnan Manoharan
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks ppl,

I am now using jQuery as usual.

Now I have a doubt like if I am using a Struts Action class as the url for AJAX call as below



and in struts-config.xml,


then finally SampleActionClass.java



I really do not know what should I return here so that am not directing the page to any other page. Basically the result of the operation must be carried as response to the AJAX call as an XML. I dont want to navigate anywhere.

Please tell me what should I return in that function..

Thanks,
Muthu
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try prototype.js or Dojo toolkit as Ajax framework.
 
Muthukrishnan Manoharan
Ranch Hand
Posts: 91
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah thanks Vikram, anyway I have started using jQuery for the same.

But can anybody help me how I would write the execute function of Action Class (please check the code above) especially what should I return for the ActionForward..
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Muthukrishnan Manoharan wrote:especially what should I return for the ActionForward..


null,
The action class will be like this


 
Is that a spider in your hair? Here, threaten it with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic