我想实现一个带有行编辑的表。
我在展示中找到了这个例子,但我每次都收到这个错误:
- javax.servlet.ServletException:找不到属性类的设置器
- java.lang.IllegalArgumentException:找不到属性类的设置器
我的 xhtml
<a4j:status onstart="#{rich:component('statPane')}.show()"
onstop="#{rich:component('statPane')}.hide()" />
<h:form id="form">
<rich:dataScroller for="dataTableId" maxPages="8" />
<rich:extendedDataTable id="dataTableId" rows="200"
value="#{declarationReglementaireModel.detailCurrentDecReg.decReg.listLigneTa3SDTO}"
var="ligneTA3" frozenColumns="2"
style="height:300px; width:800px;" selectionMode="none">
<rich:column width="35px">
<h:panelGrid columns="1" cellpadding="2">
<a4j:commandLink class="lien_detail" render="editGrid"
execute="@this"
oncomplete="#{rich:component('editPane')}.show()">
<span class="icone icone-edit icone-align-center" />
<a4j:param value="1"
assignTo="#{modifDecRegTa3Model.currentLigneTa3Index}" />
<f:setPropertyActionListener target="#{modifDecRegTa3Model.editedRow}"
value="#{ligne}" />
</a4j:commandLink>
</h:panelGrid>
</rich:column>
<rich:column width="150px" sortBy="#{ligneTA3.idTitre}"
sortOrder="ascending">
<f:facet name="header">Référence Titre</f:facet>
<h:outputText value="#{ligneTA3.idTitre}">
</h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="a" />
</f:facet>
<h:outputText value="#{ligneTA3.vlColA}">
</h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="b" />
</f:facet>
<h:outputText value="#{ligneTA3.vlColB}">
</h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="c" />
</f:facet>
<h:outputText value="#{ligneTA3.vlColC}">
</h:outputText>
</rich:column>
<rich:dataScroller for="dataTableId" maxPages="8" />
<rich:popupPanel id="statPane" autosized="true">
Please wait...
</rich:popupPanel>
<rich:popupPanel header="Modifier ligne" id="editPane" domElementAttachment="parent" width="400" height="170">
<h:panelGrid columns="3" id="editGrid">
<h:outputText value="vlColA" />
<h:outputText value="#{modifDecRegTa3Model.editedRow.vlColA}" />
<h:panelGroup />
<h:outputText value="vlColB" />
<h:outputText value="#{modifDecRegTa3Model.editedRow.vlColB}" />
<h:panelGroup />
<h:outputText value="vlColC" />
<h:inputText value="#{cmodifDecRegTa3Model.editedRow.vlColC}" required="true" requiredMessage="Price is required" id="price"/>
</h:panelGrid>
<a4j:commandButton value="Store" action="#{rechercheDecRgltCtrl.validerModifications}" render="table" execute="editPane"
oncomplete="if (#{facesContext.maximumSeverity==null}) {#{rich:component('editPane')}.hide();}" />
<a4j:commandButton value="Cancel" onclick="#{rich:component('editPane')}.hide(); return false;" />
</rich:popupPanel>
</h:form>
</h:panelGrid>
</h:form>
我的模特
@ManagedBean(name="modifDecRegTa3Model")
@SessionScoped
public class ModifDecRegTa3Model {
private static final long serialVersionUID = 1L;
private LigneTa3DTO currentElement;
private Integer selectedPage;
private int currentLigneTa3Index;
private LigneTa3DTO editedRow;
public ModifDecRegTa3Model() {
super();
}
public LigneTa3DTO getCurrentElement() {
return currentElement;
}
public void setCurrentElement(LigneTa3DTO currentElement) {
this.currentElement = currentElement;
}
public Integer getSelectedPage() {
return selectedPage;
}
public void setSelectedPage(Integer selectedPage) {
this.selectedPage = selectedPage;
}
public int getCurrentLigneTa3Index() {
return currentLigneTa3Index;
}
public void setCurrentLigneTa3Index(int currentLigneTa3Index) {
this.currentLigneTa3Index = currentLigneTa3Index;
}
public LigneTa3DTO getEditedRow() {
return editedRow;
}
public void setEditedRow(LigneTa3DTO editedRow) {
this.editedRow = editedRow;
}
}