views:

22

answers:

1

Hello.

I have a list and I show it with s:select without any problem but I want it's header value to be one of list's items and it differs on different runs. something like this:

<s:select list="roleList" name="role" headerkey="" headerValue="%{euser.role}" cssClass="textfield"/>

value of 'euser.role' is one of 'roleList' items but if I use this, it adds the value for header and then I have 2 value of that item on my select.

I need this for an edit page, if user doesn't want to change value of this option, then it'll have previous value.

Thanks in advance.

A: 

Does it have to be a header? Can you just set the selected value so that is what displays first? In your Action you can figure out what the header value should be

//action method
    int valueToShow = 0; //get the id to show

//jsp
    <s:select list="roleList" name="role" headerkey="" value="%{valueToShow}" cssClass="textfield"/>

This way it will display the value you want, but it wont get releated twice.

Thank you so much.
Zim