I have a Java Dynamic Web Module project (version 2.5) with RichFaces, Spring Web Flow and Hibernate. The project is deployed in Apache Tomcat (6.0.20 in server, 6.0.37 and 7.0.39 in my machine, for dev purposes). I'm getting this error frequently:
Caused by: javax.el.ELException: /WEB-INF/flows/monitoring/monitor.xhtml @139,114 rendered="#{search.journeyRecord.valid}": Cannot convert valid of type class java.lang.String to class java.lang.Integer
Valid is a Transient Boolean attribute from JourneyRecord
class. Its declaration is showed below:
@Transient
public boolean isValid() {
if (search != null) {
return search.getStatus() == Search.WITH_INSURANCE_COVER;
} else {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.HOUR, -12);
return calendar.after(registrationDate);
}
}
I updated my jsf-facelets Maven Package to version 1.1.15.
Search Bean:
@Entity
public class Pesquisa implements Serializable {
...
private char status;
...
/**
* @return the status
*/
public char getStatus() {
return status;
}
/**
* @param status
* the status to set
*/
public void setStatus(char status) {
this.status = status;
}
...
}
JourneyRecord Bean:
@Entity
public class RegistroViagem implements Serializable{
...
private Date registrationDate;
...
/**
* @return the registrationDate
*/
public Date getRegistrationDate() {
return registrationDate;
}
/**
* @param registrationDate
* the registrationDate to set
*/
public void setRegistrationDate(Date registrationDate) {
this.registrationDate = registrationDate;
}
...
@Transient
public boolean isValid() { ... }
...
}
JSF:
...
<rich:column style="text-align:center;">
<f:facet name="header">Protocol Number</f:facet>
<h:outputText value="#{search.journeyRecord.journeyNumber}" rendered="#{search.journeyRecord.valid}" />
</rich:column>
...
Sorry. It was my mess, but I think the question can be useful for other people.
Here in JSF:
...
<rich:column style="text-align:center;">
<f:facet name="header">Protocol Number</f:facet>
<h:outputText value="#{search.journeyRecord.journeyNumber}" rendered="#{search.journeyRecord.valid}" />
</rich:column>
...
search.journeyRecord
is a List<JourneyRecord>
. The attribute type was changed by another person of the team.
As @BalusC suggested, it's a complex type. EL tries to get its contents using toString()
method, and convert it to Integer
afterwards. I changed search.journeyRecord
to another transient attribute that returns only an element and worked.
Thanks to all that commented.