Hi, I am using Struts 2.0.12 and having a problem getting selected=""
to work on s:select with my data converter. It seems that converter is
called when I submit from the select box, but when its populated its
never called.

1. My select is:

<s:select name="state" list='states'  listKey="id" listValue="name"
key="state"/>

2. Converter is defined in xwork-conversion file

3. public class StateConverter extends StrutsTypeConverter {
        
    public Object convertFromString(Map context, String[] values,
Class toClass) {
        StateDAO stateDAO = new StateDAOHibernate();
        return stateDAO.findById(Integer.parseInt(values[0]), false);
    }

    public String convertToString(Map context, Object o) {
        State state = (State) o;
        return String.valueOf(state.getId());
    }
}


So on view the select list is populated from states which is
List<State> but even though my State state; is set, its not being
selected. However, if I add <s:textfield name="state"/> I do get Id of
that State so conversion is working but it seems as if its ignored by
<s:select

Any ideas? Thanks, Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to