java.lang.IllegalArgumentException: Setter not found for property class

☆樱花仙子☆ 提交于 2019-12-10 21:08:42

问题


I want to implement a table with row editing.

I found this exemple in the showcase, but I get this error evry time :

  • javax.servlet.ServletException: Setter not found for property class
  • java.lang.IllegalArgumentException: Setter not found for property class

My 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>

My Model

@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;
}

}

回答1:


This is probably related to your bad attribute :

<a4j:commandLink class="lien_detail" />

There is no attribute class for the component a4j:commandLink you should use styleClass instead.



来源:https://stackoverflow.com/questions/16935343/java-lang-illegalargumentexception-setter-not-found-for-property-class

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!