• 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

Struts and Ajax

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..

I am creating a web app in Struts 1.3. One of the JSPs has a requirement wherein a multiselect box and a textbox need to get filled, based on the selection in a dropdown.
I am not sure if there is any standard/well known way of doing this in Struts.
Any suggestions/pointers would be really great.

Thanks
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My approach to this would be to make an AJAX call to an action mapped behind a JSON namespace (e.g., myApp/json/getObject.action) passing the value of the select field (e.g., ?mySelect=1). Use the response to populate the multi-select and/or text box using JavaScript.

I've never used it, myself, but you might look into the dojo plug-in. Of course, you don't need to use dojo. If you're used to another js library, use it. I use prototype (js framework lib) and scriptaculous (effects engine lib). I would also use the json plug-in for your responses. It's very simple to set up and use. It basically just maps your action as json.

Hope that helps get you started.

Resources:
  • json example
  • dojo & ajax example
  • prototype & ajax
  • script.aculo.us
  •  
    Kevin Biesbrock
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Shoot. I didn't see that you were using Struts 1.3....so I'm not sure how much of what I said was relevant.

    Also...why 1.3?!?! Get with the times, man! ;)

    Kevin Biesbrock wrote:My approach to this would be to make an AJAX call to an action mapped behind a JSON namespace (e.g., myApp/json/getObject.action) passing the value of the select field (e.g., ?mySelect=1). Use the response to populate the multi-select and/or text box using JavaScript.

    I've never used it, myself, but you might look into the dojo plug-in. Of course, you don't need to use dojo. If you're used to another js library, use it. I use prototype (js framework lib) and scriptaculous (effects engine lib). I would also use the json plug-in for your responses. It's very simple to set up and use. It basically just maps your action as json.

    Hope that helps get you started.

    Resources:

  • json example
  • dojo & ajax example
  • prototype & ajax
  • script.aculo.us
  •  
    Sheriff
    Posts: 67746
    173
    Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    At this point, Prototype and Scriptaculous are dinosaurs. You might want to investigate jQuery.
     
    Kevin Biesbrock
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Bear Bibeault wrote:At this point, Prototype and Scriptaculous are dinosaurs. You might want to investigate jQuery.



    haha. okay...

    [edit]
    ...although, I just found a performance comparison and....looks like you have a point. Sorry to doubt you, sir

    Might be time to switch...even though I really like the syntax of prototype.
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic