Greg,

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>
  
        
private static void setConverterTruncateAt(FacesContext facesContext,
TruncateConverter converter, String value) {
        if (value == null) {
                converter.setTruncateAt(0);
        } else if (UIComponentTag.isValueReference(value)) {
                ValueBinding vb =
facesContext.getApplication().createValueBinding(value);
        Object o = vb.getValue(facesContext);
        if (o instanceof Number) {
                converter.setTruncateAt(((Number) o).intValue());
        } else {
        converter.setTruncateAt(Integer.parseInt(o.toString()));
//line 62
        }       


Michael


-----Original Message-----
From: Lindholm, Greg [mailto:[EMAIL PROTECTED] 
Sent: Dienstag, 11. April 2006 18:32
To: MyFaces Discussion
Subject: RE: tag to truncate outputText?

-----Original Message----- From: Michael Heinen
> Now I'm really curious about your version and added it to my project.
> But I get the following error (see below) on a really simple page.
>
> Do you have any ideas?
> I am using MyFaces 1.1.1.

I'm also use MyFaces 1.1.1 with Tomcat 5.0.25.

I don't know what's causing the errors your getting.

The only changes I made to the code I posted was:
- changed the package to xxx
- removed the uri info from the TLD 
        <uri>http://xxx.xxx/xxx</uri>
- I didn't show the taglib tag
        <%@ taglib prefix="xxx" uri="http://xxx.xxx/xxx"%>
- I didn't show the TLD doctype (see below)


Ensure your xxx.tld is in WEB-INF and starts:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library
1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd";>
<taglib>...



Reply via email to