3

I wanted to create a command link column in p:dataTable so I could delete rows from the table. so I added this column to the table :

<p:column>
  <p:commandLink process="@form" update=":growl @form"  action="#{cityManagedBean.deleteCity(cityItem)}">
    <h:graphicImage library="images" name="icon/delete.png"/>
  </p:commandLink>
</p:column>

according to these threads : How can I pass a parameter to a commandLink inside a data table?

CDI bean List in the data table is null on submit from JSF

I understand that the data model used in the dataTable must be preserved in the post request processing. and when I changed the scope of the backing bean to conversation-scoped everything works fine now.

but my questions are :

  1. why the data model must be preserved. I mean what's happening under the hood in JSF life cycle that, I need to preserve the data model of the dataTable?

  2. in the primefaces demo site in dataTable tutorial section, no converter is used when selecting and working with POJO in the dataTable. what is happening under the hood that makes it unnecessary to convert objects to Strings and vice versa?

  3. if this is possible to pass POJO from Facelets to the backing bean without converters, why it is necessary to define converters when working with selectOneMenu and SelectManyMenu components?

chubock
  • 834
  • 8
  • 16

0 Answers0