Possible error resolving EL expressions when using Facelets
-----------------------------------------------------------

                 Key: TOBAGO-535
                 URL: https://issues.apache.org/jira/browse/TOBAGO-535
             Project: MyFaces Tobago
          Issue Type: Bug
          Components: Facelets
    Affects Versions: 1.0.12
            Reporter: Tobias Glensk


I wanted to set the converter to use for a tx:in from a managed bean, because 
the concrete converter is only known on runtime. My managed bean returns the Id 
for the converter correctly, but I get an error message.

Example Facelet Snippet:
<c:forEach items="${controller.currentBean.properties}" var="item">
 
  <!-- 1) below doesn't work, error message: Cannot convert 
de.nordlbit.FDTStringConverter of type class java.lang.String to interface 
javax.faces.convert.Converter -->
  <tc:in label="${item.name}" value="${item.value}" 
converter="${item.converterId}" />

  <!-- 2) below doesn't work, error message: Cannot convert 
de.nordlbit.FDTStringConverter of type class java.lang.String to interface 
javax.faces.convert.Converter -->
  <c:set var="converterId" value="${item.converterId}" />
  <tc:in label="${item.name}" value="${item.value}" converter="${converterId}" 
/>
                                
  <!--3) below works, setting String statically -->
  <tx:in label="${item.name}" value="${item.value}" 
converter="de.nordlbit.FDTStringConverter" />

</c:forEach> 

${item.converterId} returns a String with the value 
"de.nordlbit.FDTStringConverter ". Using the examples 1 and 2 I get an error 
message, setting the same String like in example 3 statically, it works. The 
error message / stacktrace returns for the examples 1 and 2:

08.11.2007 10:16:42 com.sun.facelets.FaceletViewHandler handleRenderException
SCHWERWIEGEND: Error Rendering View[/sandbox/wizard.xhtml]
java.lang.IllegalArgumentException: Cannot convert 
de.nordlbit.FDTStringConverter of type class java.lang.String to interface 
javax.faces.convert.Converter
at com.sun.el.lang.ELSupport.coerceToType(ELSupport.java:329)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185)
at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
at javax.faces.component.UIOutput.getConverter(UIOutput.java:137)
at 
org.apache.myfaces.tobago.renderkit.RenderUtil.getFormattedValue(RenderUtil.java:128)
at 
org.apache.myfaces.tobago.renderkit.RendererBase.getCurrentValue(RendererBase.java:96)
...

Example Snippet from the managed bean item class

 /**
     * @return the converterId
     */
    public String getConverterId() {
        return this.converterId;
    }
 
I tried to use # instead of $ but the same behaviour can be observed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to