The value binding logic is taken right out of a book.
I tested it getting the truncateAt position from a bundle 
and it worked fine.

(Are you sure your #{columnHeader.truncateAtPosition} is 
returning a non-null?)

Need to add a check for null coming back from the getValue().

I haven't done anything else with evaluating value bindings 
so can't really help.
Would need to research and debug.


-----Original Message-----
From: Michael Heinen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 12, 2006 7:23 AM
To: MyFaces Discussion
Subject: RE: tag to truncate outputText?

Does the truncateOutput tag work with JSF EL? 

The following snippet causes a NullPointerException in the
TruncateConverterTag at line 62, which is marked below because
the Object o is always null.

<t:columns id="columns"
   value="#{MyControllerBean.columnHeaders}"
   var="columnHeader">

<h:outputText value="#{DynaAnnoControllerBean.cellValue}">
     <rm:truncateOutput truncateAt="#{columnHeader.truncateAtPosition}"
continuationMark="..."/>
</h:outputText>
  
        
ValueBinding vb =
facesContext.getApplication().createValueBinding(value);
Object o = vb.getValue(facesContext);

if (o == null) // Add error check
{
        // do some error processing
}

if (o instanceof Number) {
        converter.setTruncateAt(((Number) o).intValue());
} else {
        converter.setTruncateAt(Integer.parseInt(o.toString()));
        }       


Reply via email to