On 3/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> In my jsp I am using users ArrayList which is collection of User bean on
> server side.
> My drop down list works fine as under when I use only one display
> userNameShort in my example.
>
> <html:select property="userIdNew">
>   <option value="-1">Choose User...</option>
>   <html:options collection="users"
>                 property="userId"
>                 labelProperty="userNameShort" />
> </html:select>
>
> Now I want to combine two attributes concatenation in label for e.g.
> userId+"("+userNameShort"+")"
>
> how would I do that ?

Create a read-only property in the User bean that returns
userId+"("+userNameShort"+")". For example:

public class User ... {
  ...
  public String getUserIdAndName() {
    return userId+"("+userNameShort"+")";
  }
}

<html:select property="userIdNew">
  <option value="-1">Choose User...</option>
  <html:options collection="users"
                property="userId"
                labelProperty="userIdAndName" />
</html:select>

Michael.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to