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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

html drop down question

  • 02-06-2005 3:20pm
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 2,170 ✭✭✭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