What is the type of Different Complex Type, is it Enum? Struts usually provides mapping for String and primitive type.
If its not Enum, you should try mapping the value of Select which is string, to a class attribute which is of type String. If its Enum, you may need to write a custom handler for mapping Enum type, from String. *Thanks & Regards/ **सादर**,* *Gaurav Daga* *togauravd...@gmail.com <togauravd...@gmail.com> | +1.201.308.3242 | Web Presence <http://goo.gl/lW0nh> * Do not follow where the path may lead. Go instead where there is no path and leave a trail. - Harold R. McAlindon On Thu, Apr 3, 2014 at 2:19 AM, Fabian Richter <frich...@mtg.de> wrote: > Hey, > > not sure this is a Bug or a Feature, but I ran into the following > troubles, someone might be able to explain: > > class ComplexType { > private DifferentComplexType test; > > public void setTest(DifferentComplexType test){ > this.test = test; > } > public DifferentComplexType getTest(){ > return this.test; > } > } > > In an action class I have > > private ComplexType field; > > public ComplexType getField(){ > return this.field; > } > > public void setField(ComplexType field){ > this.field = field; > } > > Now in this Action, I am setting "test" with a <s:select list="..." > key="field.test" headerKey="" headerValue="Undefined" /> > > But when I want to null it, by selecting the header entry "Undefined", > Struts is not calling getField().setTest() its not changing "test" in > "field" at all. > > When I add to my action > > public DifferentComplexType getTest(){ > return this.field.getTest(); > } > > public void setTest(DifferentComplexType test){ > this.field.setTest(test); > } > > and change the <s:select> to use key="test" it works like a charm. > > Is that how its supposed to be? If so, why? > > Thank you for explaining! > > Best > Fabian > >