incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Koci <Martin.K...@aura.cz>
Subject SimpleSelectOneRenderer should not evaluate select items if valuebinding leads to null
Date Thu, 24 Aug 2006 20:01:40 GMT
Hello,

I'm  using selectOneChoice with attribute disabled="true" so output is
not HTML select  but normal span .
 
But if I have complex valueBinding such as
value="#{s012modelId.otherModel.formObject.objectXY.property}" and
something in expression is null (formObject in my case, because
selectOne gets rendered in initial form state - no objects are loaded)
i've got exception: 
javax.faces.el.PropertyNotFoundException: Base is null: .formObject
	at
org.apache.myfaces.el.ValueBindingImpl.resolveToBaseAndProperty(ValueBindingImpl.java:474)
	at
org.apache.myfaces.el.ValueBindingImpl.getType(ValueBindingImpl.java:172)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.ValueRenderer.getDefaultConverter(ValueRenderer.java:72)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleSelectOneRenderer.renderNonElementContent(SimpleSelectOneRenderer.java:306)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.encodeAllAsNonElement(FormElementRenderer.java:127)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.encodeAll(FormElementRenderer.java:60)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer.delegateRenderer(CoreRenderer.java:290)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.encodeAll(InputLabelAndMessageRenderer.java:106)
	at
org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderer.encodeEnd(CoreRenderer.java:178)

This is because renderer wants to get default converter but value
expression leads to null so no type is available.

Adding this three lines (as first lines ) in
SimpleSelectOneRenderer.renderNonElementContent solved my problem:

  Object value = getValue(bean);
  if (value == null)
		  return;


Thanks

Martin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message