aspose file tools*
The moose likes Struts and the fly likes Struts and Ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts and Ajax" Watch "Struts and Ajax" New topic
Author

Struts and Ajax

Sahil Dave
Greenhorn

Joined: Nov 10, 2010
Posts: 11
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


Sahil
Kevin Biesbrock
Greenhorn

Joined: Nov 10, 2010
Posts: 4
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

    Joined: Nov 10, 2010
    Posts: 4
    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
  • Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60048
        
      65

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


    [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Kevin Biesbrock
    Greenhorn

    Joined: Nov 10, 2010
    Posts: 4
    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Struts and Ajax
     
    Similar Threads
    struts
    Loading an array in jsp using strut framework
    What's new in Struts 1.2.1?
    could not connect to oracle database from struts application
    book for struts