File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts html:options and JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts html:options and JavaScript" Watch "Struts html:options and JavaScript" New topic

Struts html:options and JavaScript

Vijay Sarathy

Joined: Jul 01, 2007
Posts: 2
I have a dropdown which I populate with struts html ptions tag.

i will add new elements to my dropdown through javascript.

My question is whether my new items (which are added by script) would get updated in the arraylist I�m using for html ptions

(This happens fine for text boxes, when JavaScript sets some value in text box and I do a submit and comeback to same page I see the value retained)

thanks in advance
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

Yes the options will update

===Vyas Sanzgiri===
My Blog
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Actually, no, they will not. The list of options is not an input control, and will not be passed to the server when the form is submitted. If you want to update the list of options, you will have to put the options in hidden input fields.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Struts html:options and JavaScript
It's not a secret anymore!