Francesco Francesco - 1 year ago 62
Java Question

rich:calendar and "The class 'java.lang.String' does not have the property ..." error

I have the following situation:


public interface Ranged{
public Object getRangeStart();
public Object getRangeEnd();

public void setRangeStart(Object rangeStart);
public void setRangeEnd(Object rangeEnd);

public void setRange(boolean isRange);
public boolean getRange();}

implementing class:

public class CreationDateRange implements Ranged, Serializable{
private static final long serialVersionUID = SerialVersionUID.getSerialVersionUID();

public DateRange()

private Date dateFrom;
private Date dateTo;
private boolean isRange = false;

public Object getRangeStart()
return (Date)dateFrom;

public Object getRangeEnd()
return (Date)dateTo;

public void setRangeStart( Object from )
this.dateFrom = (Date)from;

public void setRangeEnd( Object to )
this.dateTo = (Date)to;

public void setRange( boolean isRange )
this.isRange = isRange;

public boolean getRange()
return isRange;


private Object updateDate = new DateRange();

private Object creationDate = new DateRange();

public void setUpdateDate( Object updateDate )
this.updateDate = updateDate;

public Object getUpdateDate()
return updateDate;

public void setCreationDate( Object creationDate )
this.creationDate = creationDate;

public Object getCreationDate()
return creationDate;


<f:viewParam name="creationDate" value="#{doiListController.model.creationDate}"/>
<f:viewParam name="updateDate" value="#{doiListController.model.updateDate}"/>
<td style="font-size: 5pt; border: 0; min-width:60px">
<rich:calendar value="#{listModel.creationDate.rangeStart}"
datePattern="yyyy-MM-dd" enableManualInput="true"
<f:convertDateTime pattern="yyyy-mm-dd" />


>[exec] javax.faces.component.UpdateModelException: javax.el.PropertyNotFoundException: /view/doi/doiListView.xhtml @90,59 value="#{listModel.creationDate.rangeStart}": The cla
ss 'java.lang.String' does not have the property 'rangeStart'.
[exec] at javax.faces.component.UIInput.updateModel(
[exec] at javax.faces.component.UIInput.processUpdates(
[exec] at javax.faces.component.UIComponentBase.processUpdates(
[exec] at javax.faces.component.UIForm.processUpdates(
[exec] at javax.faces.component.UIComponentBase.processUpdates(
[exec] at javax.faces.component.UIViewRoot.processUpdates(
[exec] at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(
[exec] at com.sun.faces.lifecycle.Phase.doPhase(
[exec] at com.sun.faces.lifecycle.LifecycleImpl.execute(
[exec] at javax.faces.webapp.FacesServlet.service(
[exec] at org.apache.catalina.core.StandardWrapper.service(
[exec] at org.apache.catalina.core.StandardWrapperValve.invoke(
[exec] at org.apache.catalina.core.StandardContextValve.invoke(
[exec] at org.apache.catalina.core.StandardPipeline.doInvoke(
[exec] at org.apache.catalina.core.StandardPipeline.invoke(
[exec] at com.sun.enterprise.web.WebPipeline.invoke(
[exec] at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(
[exec] at org.apache.catalina.core.StandardHostValve.invoke(
[exec] at org.apache.catalina.connector.CoyoteAdapter.doService(
[exec] at org.apache.catalina.connector.CoyoteAdapter.service(
[exec] at
[exec] at com.sun.grizzly.http.ProcessorTask.invokeAdapter(
[exec] at com.sun.grizzly.http.ProcessorTask.doProcess(
[exec] at com.sun.grizzly.http.ProcessorTask.process(
[exec] at com.sun.grizzly.http.DefaultProtocolFilter.execute(
[exec] at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(
[exec] at com.sun.grizzly.DefaultProtocolChain.execute(
[exec] at com.sun.grizzly.DefaultProtocolChain.execute(
[exec] at com.sun.grizzly.http.HttpProtocolChain.execute(
[exec] at com.sun.grizzly.ProtocolChainContextTask.doCall(
[exec] at
[exec] at
[exec] at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(
[exec] at com.sun.grizzly.util.AbstractThreadPool$
[exec] at
[exec] Caused by: javax.el.PropertyNotFoundException: /view/doi/doiListView.xhtml @90,59 value="#{listModel.creationDate.rangeStart}": The class 'java.lang.String' does not ha
ve the property 'rangeStart'.
[exec] at com.sun.faces.facelets.el.TagValueExpression.setValue(
[exec] at javax.faces.component.UIInput.updateModel(
[exec] ... 34 more

Can someone help me and say me what am I missing, please?

Answer Source

The exception and stacktrace is telling that #{listModel.creationDate} is actually a String during the update model values phase of the form submit request.

That can for example happen if something in your view has called listMode.setCreationDate() with a String as argument beforehand. For example, by a <f:viewParam>, <h:inputHidden>, Converter-for-class, or whatever else is returning a String instead of the desired object type.

Put a breakpoint on the setter method and track the root cause down in the stack. Alternatively, you can also replace Object type by Ranged type or somehing more specific, so that JSF would possibly throw/display a conversion exception/error which is usually more self-explaining.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download