Thread View: pl.comp.lang.java
2 messages
2 total messages
Started by Jadalbert
Wed, 27 Aug 2014 21:29
Modyfikacja pól tablicy w JSF
Author: Jadalbert
Date: Wed, 27 Aug 2014 21:29
Date: Wed, 27 Aug 2014 21:29
43 lines
2173 bytes
2173 bytes
Nie mam pojęcia dlaczego w ogóle nie działa setter dla tablicy (debugger
tam "nie wchodzi" a w gettera tak).
w beans'ie jest:
...
protected double [] tab;
...
{w konstruktorze}
tab = new double [3];
tab[0] = 1.0;
tab[1] = 2.0;
tab[2] = 3.0;
...
public double[] getTab() {
return tab;
}
public void setTab(double[] tab) {
this.tab = tab;
}
w JSF jest
...
<h:dataTable id="table" value="#{test1.tab}" var="t" >
<h:column>
<h:inputText value="#{test1.tab[0]}" size="4"/>
<h:inputText value="#{test1.tab[1]}" size="4"/>
<h:inputText value="#{test1.tab[2]}" size="4"/>
<h:commandButton value="X">
<f:ajax execute="@this" render="@form"/>
</h:commandButton>
</h:column>
</h:dataTable>
Chciałbym modyfikować wartości tabeli, ale nie wchodzi mi w ogóle do
settera. Dodam, że kod powyższy jest przykładowy i jeden z wielu,
których próbowałem. Setter był również napisany jako:
...
this.tab[0] = tab[0] itd.
Mógłby ktoś mi to wyjaśnić, ale łopatologicznie bo się uczę?
I może jeszcze dlaczego w <h:dataTable> nie działa <f:ajax>.
Re: Modyfikacja pól tablicy w JSF
Author: WOJSAL
Date: Sun, 14 Sep 2014 14:28
Date: Sun, 14 Sep 2014 14:28
8 lines
1163 bytes
1163 bytes
Jaki masz zasięg beana? Pozdrawiam, Wojtek --- Ta wiadomość e-mail jest wolna od wirusów i złośliwego oprogramowania, ponieważ ochrona avast! Antivirus jest aktywna. http://www.avast.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads