This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Struts and the fly likes populating select options from database help urgent!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "populating select options from database help urgent!!!!" Watch "populating select options from database help urgent!!!!" New topic
Author

populating select options from database help urgent!!!!

Manoj John
Ranch Hand

Joined: May 13, 2004
Posts: 36
In my application one page where i am getting details of user
on submission it calls one action /saveDetails (/saveDetails that maps to SaveDetailsAction.java).
In this page there is one select for country.on selection of country it is to load state in the next select with respect to country selected.
(Now i am doing it with javascript but to change as said above).
for this which is better way. i tried by creating a new Action class , Form class and selects onChange=reload() i am calling that action by
------------------------code---------------
function reload()
{
document.forms[0].action='getstate.do'; //maps to StateCountry.class
document.forms[0].submit();

}

But my PL is not satisfied with this, bcz he never wanted to create new Action class for this .
please give a solution for this.....(especially for using same action class ie here SaveDetailAction.....
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4725

You could in your Action check to see if a button was clicked as any clicked button would be added as a parameter to the submission.

Since the country drop-down is not a button, there should be no button parameter sent with the post.

The Action would say (roughly):
if(button is null){
change state values in the ActionForm
}else{ // button was clicked
do the normal stuff
}


A good workman is known by his tools.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: populating select options from database help urgent!!!!
 
Similar Threads
[Struts 2] How to populate select control after selection of a value in another select control
Html:options with Java script
Calling Action class in pop up window
Displaying Database values on jsp page in struts 1.3
how to get the value selected from listbox in jsp format