aspose file tools
The moose likes Struts and the fly likes doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "doubt" Watch "doubt" New topic
Author

doubt

kittu karan
Ranch Hand

Joined: Mar 09, 2008
Posts: 63
Hi,
I am kiran I have a task If I click one option box like country then corresponding states to appear,than I click states than next option box must display cities.please see this link you will get an idea http://www.bharatbloodbank.com/search.php How to do it in struts.
rahul khanna
Ranch Hand

Joined: Sep 14, 2005
Posts: 48
Try Ajax - Java web parts
Download the example code that comes with download and you will get a ready made example for exactly what you are trying to do.
kittu karan
Ranch Hand

Joined: Mar 09, 2008
Posts: 63
thanks rahul,
but my TL wants to do it in struts only, is it possible to it.
rahul khanna
Ranch Hand

Joined: Sep 14, 2005
Posts: 48
That would have been a neat way of doing it .

Proabably you can prepopulate ALL the dropdown(s) and show only the required ones.
Using javascipt use the onclick of the 1st drop down to show the 2nd one.
That may get messy though.
Subhash Bhushan C
Ranch Hand

Joined: Jan 27, 2005
Posts: 106
Here's another way to do it:

In the JSP page, put if conditions for display of fields (after the first field) to be shown only if the previous field has been set. Write helper classes, with proper constructors to feed data into the combo/select box.

The submit button can invoke the same action. Action class can check whether the last field has been set, if not return a different status like "INCOMPLETE". You will have to declare this in your action class, or ActionSupport class if you have extended from it as follows:
public static final String INCOMPLETE = "incomplete";
You can map the status INCOMPLETE in struts.xml to show the same jsp page again.




But you will have to be very careful to code your helper classes, Cities/Areas etc... to have constructors which take appropriate state/city/area inputs.
[ April 21, 2008: Message edited by: Subhash Bhushan ]

Regards,<br />Subhash Bhushan.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: doubt
 
Similar Threads
Doubt
doubt
How to write in AJAX
Store MP3 files online
Learning guitar --beginner