File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes html:select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "html:select" Watch "html:select" New topic


Jherald Lacambra
Ranch Hand

Joined: Feb 02, 2005
Posts: 129
Hi I am new to struts and i want to know how to populate the html:select from data. I have to html:select. The values of the second select must depends on the first html:select


The values of the first options of the html:select are:
If i choose shape, the options for the second html:select must be

And if i choose size the options of the second must be

I think javascript cannot solve this bacause i am polpulating the html:select from database.

Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

If you're looking for help specifically with Struts, you should go to the Struts forum...

But this question really deals more with design of application flow rather than Struts directly - there are several choices you could make, depending on your application -

  • Send all possible information for all choices to the client and do JavaScript manipulation of the forms as choices are made.
  • Restucture your application so that what is currently one form is spread across 3 real forms, save data in session on the server until all forms are filled in.
  • Use AJAX - make a background request to the server using JavaScript when the button is pressed to make a quick request to the server to get the new information. (Visit the HTML/JavaScript forum here on JavaRanch for more information about AJAX...)

  • -Nate
    Write once, run anywhere, because there's nowhere to hide! - /. A.C.
    I agree. Here's the link:
    subject: html:select
    It's not a secret anymore!