• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Struts 1.1 and Ajax : How to implement ajax functionality in struts 1.1

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to implement ajax functionality in our web application which is based on struts 1.1.

I know how ajax works but not sure about the same in struts. I have below queries, could you please provide your inputs?

My requirement : Need to populate drop down values through ajax whenever user changes state and country on same page.

If I fire a action class via ajax, how should I write struts-config.xml? because on success there will be no forward page and do I need to include "ActionForward(mapping.findForward("success"))" in action class?

Please let me know the answers.

Thanks
Nagaraj

 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The best practice is: don't use Struts 1. Struts 2 is easier to use and has common AJAX functionality available as plugins (i.e. JSON results and jQuery AJAX controls).
That said, the answer to your question is "perhaps". If your action is writing the result directly to the client, you do not need to declare a result in struts-config.xml and your action should return null. On the other hand, a JSP can be used to create any text format so you can configure a result in struts-config.xml and use that JSP to return XML or JSON or whatever your client expects.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic