You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bernhard Oberndorfer <be...@xpecto.com> on 2002/11/06 01:15:12 UTC

When using a html:multibox element, no setter-methode is called.

Hello

I´m using a logic:iterate and html:multibox element in my jsp-page.
The getter-methode of my multibox-element(getSelectedFoos()) is called as it
should.
But the setter-methode(setSelectedFoos()) is never called by the controller.
Why? What I´m doing wrong?

I´m using Struts 1.1-b2.

-

My JSP-page:

<logic:iterate name="treeSet" id="element" type="foo">
 <html:multibox property="selectedFoos" value="<%= element.toString() %>"/>
</logic:iterate>

-

My form bean:

private String[] selectedFoos = new String[0];  // no checkbox selected

public void reset(....) {
 selectedFoos = new String[0];
}

public TreeSet getTreeSet() {
 ...
}

public String[] getSelectedFoos() {
 return this.selectedFoos;
}

public void setSelectedFoos(String[] s) {
 this.selectedFoos = s;
}


Thanks

Bernhard Oberndorfer
---
bernhard.oberndorfer@xpecto.com
http://www.xpecto.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: When using a html:multibox element, no setter-methode is called.

Posted by Bernhard Oberndorfer <be...@xpecto.com>.
Thanks for your tips!
I need them for further working.
But I found the error!
I used the wrong enctype in my <html:form> element:
After setting enctype="multipart/form-data", the setter-methode is called as
well!

Maybe someone should make a note in
http://jakarta.apache.org/struts/struts-html.html to elements other than
<html:form> or <html:file>.



----- Original Message -----
From: "David M. Karr" <dm...@earthlink.net>
To: <st...@jakarta.apache.org>
Sent: Wednesday, November 06, 2002 7:42 AM
Subject: Re: When using a html:multibox element, no setter-methode is
called.


> >>>>> "Bernhard" == Bernhard Oberndorfer <be...@xpecto.com>
writes:
>
>     Bernhard> Hello
>     Bernhard> I´m using a logic:iterate and html:multibox element in my
jsp-page.
>     Bernhard> The getter-methode of my multibox-element(getSelectedFoos())
is called as it
>     Bernhard> should.
>     Bernhard> But the setter-methode(setSelectedFoos()) is never called by
the controller.
>     Bernhard> Why? What I´m doing wrong?
>
> Using the nightly build, I just tried a very similar structure, and I saw
no
> problem with the setter method being called.  However, note that there is
one
> situation where it doesn't call the setter method, and it's not supposed
to.
> That's when all of the generated checkboxes are unchecked.  I'm guessing
that's
> not the situation you're referring to, but I'll mention it just in case.
>
> --
> ===================================================================
> David M. Karr          ; Java/J2EE/XML/Unix/C++
> dmkarr@earthlink.net
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: When using a html:multibox element, no setter-methode is called.

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Bernhard" == Bernhard Oberndorfer <be...@xpecto.com> writes:

    Bernhard> Hello
    Bernhard> I´m using a logic:iterate and html:multibox element in my jsp-page.
    Bernhard> The getter-methode of my multibox-element(getSelectedFoos()) is called as it
    Bernhard> should.
    Bernhard> But the setter-methode(setSelectedFoos()) is never called by the controller.
    Bernhard> Why? What I´m doing wrong?

Using the nightly build, I just tried a very similar structure, and I saw no
problem with the setter method being called.  However, note that there is one
situation where it doesn't call the setter method, and it's not supposed to.
That's when all of the generated checkboxes are unchecked.  I'm guessing that's
not the situation you're referring to, but I'll mention it just in case.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>