Can you try dropping the key and value attributes of the list and just replace with name="customer.title" ?

Also can you post the HTML source of the generated SELECT+OPTIONS?

-D
On Apr 4, 2008, at 1:06 AM, JC Oosthuizen wrote:


Hi All,

I have a POJO that have a enum field as follows:
private Title title;
@Enumerated(EnumType.ORDINAL)
@Column(length = 10, nullable=true, columnDefinition="integer")
public Title getTitle() {
   return title;
}
public void setTitle(Title title) {
   this.title = title;
}

And my enum is as follows:
public enum Title {
        UNKNOWN(-1),
        MR(1),
        MRS(2);
}

On my jsp form I have:
<s:select value="%{customer.title}" key="customer.title"
label="%{getText('customer.title')}" list="titleList" cssClass="text medium"
listKey="value" listValue="label"></s:select>

This allows me to update the value for the title (have checked that it
actually updates in the database), but the select box doesn't get the
initial value when the form is opened. It will always show the first entry
in the select list.

I added a <s:label value="%{customer.title}"/> and this shows the correct value, (When MRS is selected it will show "2") so I am sure the value for
customer.title is actually correct, but the select will still show MR.

If I change the value="2" in the select tag it will correctly load MRS as
the selected value.

Any help will be appreciated.

JC Oosthuizen


--
View this message in context: 
http://www.nabble.com/Select-not-getting-value-from-bean-tp16487922s2369p16487922.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


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




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

Reply via email to