"I just use my muscles as a conversation piece, like someone walking a cheetah down 42nd Street." - Arnold Schwarzenegger
"I just use my muscles as a conversation piece, like someone walking a cheetah down 42nd Street." - Arnold Schwarzenegger
Merrill
Consultant, Sima Solutions
Originally posted by Merrill Higginson:
I've used DWR in Struts 1 applications and have found that it integrates quite well.
If you're using Struts 2, AJAX features are already integrated into the framework.
"I just use my muscles as a conversation piece, like someone walking a cheetah down 42nd Street." - Arnold Schwarzenegger
Merrill
Consultant, Sima Solutions
"I just use my muscles as a conversation piece, like someone walking a cheetah down 42nd Street." - Arnold Schwarzenegger
Merrill
Consultant, Sima Solutions
"I just use my muscles as a conversation piece, like someone walking a cheetah down 42nd Street." - Arnold Schwarzenegger
Merrill
Consultant, Sima Solutions
Originally posted by Merrill Higginson:
From what you've described, when a user has selected City, State and Name, they will press a submit button and perform a normal submit. AJAX will not be involved in this interaction at all. When the page is redisplayed, you can populate the City dropdown just as you normally would, because you already know what the State is.
The only part of this process for which you would use DWR is to populate the City dropdown after the user has entered a State. In this case, you would just write a plain Java Class with a getCities() method that takes a state as a parameter and then declare this method in your DWR config file. In your JSP, you would then write JavaScript code triggered by the onchange event of the State dropdown that would use DWR to call this method and populate the City Dropdown from the results received.
"I just use my muscles as a conversation piece, like someone walking a cheetah down 42nd Street." - Arnold Schwarzenegger
In my struts action, I do whatever I need to do to get the information to populate the destination select box, then convert it to JSON using JSON-lib (http:json-lib.sourceforge.net). Then I get set the response content type to "application/json", then use the response's default writer to output the JSON to the output stream. The javascript processes the info and fills in the select box.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |