• 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

doubt

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks rahul,
but my TL wants to do it in struts only, is it possible to it.
 
rahul khanna
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic