Hi Folks,
Let me provide perfect information about it.
Say, your formBean contains
ArrayList (int empno,String empname) (having getter/setter) with 5
objects
1001 - emp001
1002 - emp002
1O03 - emp003
1004 - emp004
1005 - emp005
So combo list contains collections= ArrayListName lableProperty
="empname" valueProperty="empno"
To select combo list value, you have empno say 003.
You need to have one member variable (Must be same as ArrayList(int
empno) that hold value.
Let say, you have created int empno (with getter/setter)
int employeeNo;
/**
* @return
*/
public int getEmployeeNo() {
return employeeNo;
}
/**
* @param i
*/
public void setEmployeeNo(int i) {
employeeNo = i;
}
Set value that has to be selected default in formBean itself once you
get that value.
Update struts statement for combo list like :
Combo collections= ArrayListName lableProperty ="empname"
valueProperty="empno" name="employeeNo"
Now check it. This will work what you need to do.
Regards,
Dharmesh
-----Original Message-----
From: David Evans [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 26, 2006 3:30 AM
To: Struts Users Mailing List
Subject: Re: RV: Combo Selection Missed
On Tue, 2006-04-25 at 16:52 -0300, Marisol Opreni wrote:
> De: Marisol Opreni [mailto:[EMAIL PROTECTED]
> Enviado el: Martes, 25 de Abril de 2006 03:52 p.m.
> Para: 'Struts Users Mailing List'
> Asunto: Combo Selection Missed
>
>
>
> Hi!
>
>
>
> I have textboxes and a drop down list.
>
> The first value is the default value selected in the combo.
>
> I complete the textboxes and select something from the combo (suppose,
the
> 3rd value).
>
>
>
> I validate textboxes.
>
> If a validation message is shown... the selection in the combo IS
MISSED. it
> shows the first value (the default one).
>
>
>
> How can I keep the value selected in the combo?
Can you provide more information please? How was the set of select
options created? Are you using struts tags? Tell more about your action
form, and the names of the property in the action form and the name of
the select tag.
Dave