Consider the following 'toy example':
I have a 'Student' class:
public class Student {
private String name;
// getters and setters
}
A managed bean, called 'StudentBean':
@ManagedBean(name = "stdBean")
@ViewScoped
public class StudentBean {
private List<Student> lstStudents = new ArrayList<>();
public List<Student> getLstStudents() {
// populate the lstStudents with some students.
}
public void remove(Student std) {
lstStudents.remove(std);
}
}
And a XHTML file with the following content within the body tag:
<h:form>
<h:dataTable value="#{stdBean.lstStudents}" var="std">
<h:column>
<f:facet name="header">Name</f:facet>
#{std.name}
</h:column>
<h:column>
<h:commandLink action="#{stdBean.remove(std)}" value="Remove"/>
</h:column>
</h:dataTable>
</h:form>
Observe that I'm passing 'std' (that is an instance of 'Student' that belongs to 'lstStudent' list) as a parameter for the 'remove' method.
The question is: for which reasons I do not need a converter for the Student class?
Best regards. Paulo.