1 Reply Latest reply on Mar 19, 2013 2:24 PM by alinju

    rich:dataTable  - edit

    alinju

      I have problem with  <h:commandLink +  <f:setPropertyActionListener in <rich:dataTable :

       

      <rich:dataTable id="i_table"

                          value="#{registroHorarioSearch.list}" rows="10"

                          var="row" rowClasses="even-row, odd-row" styleClass="table_result"

                          rendered="#{not empty registroHorarioSearch.list}"

                          sortMode="single" >

                          <rich:column sortBy="#{row.nome}">

                              <f:facet name="header">

                                  <h:outputText value="#{cadastros.nome}" />

                              </f:facet>

                              <h:outputText value="#{row.nome}" />

                          </rich:column>                  

                          <rich:column styleClass="buttons_column">

                             <h:commandLink id="i_edit" action="#{registroHorarioForm.getPage}" >

                                  <h:graphicImage value="/images/icons/edit.png"

                                      style="border:0px; margin-left:5px; margin-right:5px;" />

                                  <f:setPropertyActionListener

                                      target="#{registroHorarioForm.entity}" value="#{row}" />

                              </h:commandLink>

                          </rich:column>

                          <f:facet name="footer">

                              <rich:datascroller for="i_table" maxPages="10"

                                  renderIfSinglePage="true" stepControls="hide" />

                          </f:facet>

                      </rich:dataTable>

       

      ---------------------------------

      @Controller(value = "registroHorarioSearch")

      @Scope("request")

      public class RegistroHorarioSearchMBean {

       

          public static final String PAGE = "/pages/cadastros/professores/registroHorarioSearch";

       

          private Professor entity;

       

          private List<Professor> list;

       

          public String getPalavra() {

              return palavra;

          }

       

          public void setPalavra(String palavra) {

              this.palavra = palavra;

          }

       

          public Professor getEntity() {

              return entity;

          }

       

          @PostConstruct

          public void init() {

              entity = new Professor();

              setEntity(entity);

          }

       

          private void setEntity(Professor entity) {

              this.entity = entity;

          }

       

          public String clear() {

              init();

              return getPage();

          }

       

              public String open() {

              return getPage();

          }

       

       

          public String getPage() {

              entity = new Professor();

              return PAGE;

          }

       

          public List<Professor> getListaProfessores() {

              return listaProfessores;

          }

       

          public void setListaProfessores(List<Professor> listaProfessores) {

              this.listaProfessores = listaProfessores;

          }

       

      }

      ---------------------------------

      @Controller(value = "registroHorarioForm")

      @Scope("request")

      public class RegistroHorarioFormMBean {

       

          public static final String PAGE = "/pages/cadastros/professores/registroHorarioForm";

       

          private Professor entity;

       

          @PostConstruct

          public void init() {       

          }

       

          public String open() {

              return getPage();

          }

       

       

          public String edit() {

              return getPage();

          }

          public String getPage() {

              return PAGE;

          }

       

          public Professor getEntity() {

              return entity;

          }

       

          private void setEntity(Professor entity) {

              this.entity = entity;

          }

       

      }

      --------------------------------

      Error:

      10:11:01,357 WARNING [lifecycle] /pages/cadastros/professores/registroHorarioSearch.xhtml @85,65 target="#{registroHorarioForm.entity}": Property 'entity' not writable on type br.pucrs.grh20.domainmodel.Professor

      javax.el.PropertyNotFoundException: /pages/cadastros/professores/registroHorarioSearch.xhtml @85,65 target="#{registroHorarioForm.entity}": Property 'entity' not writable on type br.pucrs.grh20.domainmodel.Professor

        • 1. Re: rich:dataTable  - edit
          alinju

          private void setEntity(Professor entity) {

                  this.entity = entity;

              }

           

          >>>> not writable

          public void setEntity(Professor entity) {

                  this.entity = entity;

              }