Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

html drop down question

Options
  • 02-06-2005 4:20pm
    #1
    Registered Users Posts: 3,012 ✭✭✭


    Hi,

    using struts to create a dropdown on a jsp.

    I'm creating a page where details can be changed by selecting a new option on the dropdown, however, dropdowns always start at the first item on the list, so anybody who only wants to change one option would have to go through all of the other dropdowns and set them back to the original value.
    The dropdowns are populated by an arraylist of objects, contating a label and value variable.

    I already have the original label value on a bean, and I was wondering if there's a way to make sure the drop down has the same label as on the bean as it's default selection?

    Thanks.


Comments

  • Registered Users Posts: 1,268 ✭✭✭hostyle


    BizzyC wrote:
    Hi,

    using struts to create a dropdown on a jsp.

    I'm creating a page where details can be changed by selecting a new option on the dropdown, however, dropdowns always start at the first item on the list, so anybody who only wants to change one option would have to go through all of the other dropdowns and set them back to the original value.
    The dropdowns are populated by an arraylist of objects, contating a label and value variable.

    I already have the original label value on a bean, and I was wondering if there's a way to make sure the drop down has the same label as on the bean as it's default selection?

    Thanks.

    I have no idea about struts or JSP, but it sounds like you're looking for:
    <option selected="selected" value="whatever">whatever</option>
    


  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    That wont work, in order for the dropdown to work correctly, it'll have to be full of drop down objects. I cant just display the label, cause the value is the actual item required from the selection.

    I need the default selection on the drop-down to change from the first element, to the one whos label matches the on in my bean.

    The dropdown is being generated dynamically, so I cant hard code the default selection as you have above.

    Thanks for trying though.


  • Registered Users Posts: 2,157 ✭✭✭Serbian


    BizzyC wrote:
    Hi,

    using struts to create a dropdown on a jsp.

    I'm creating a page where details can be changed by selecting a new option on the dropdown, however, dropdowns always start at the first item on the list, so anybody who only wants to change one option would have to go through all of the other dropdowns and set them back to the original value.
    The dropdowns are populated by an arraylist of objects, contating a label and value variable.

    I already have the original label value on a bean, and I was wondering if there's a way to make sure the drop down has the same label as on the bean as it's default selection?

    Thanks.

    I'd say you are more likely to get a decent answer to this question on the Programming Board.


Advertisement