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

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to