myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Heinen" <...@recommind.com>
Subject RE: tag to truncate outputText?
Date Thu, 13 Apr 2006 09:07:06 GMT
Hi again,

I tested the value binding also from a bundle and this is working fine.

The problem seems to be that the truncate attribute of the converter tag
is populated before or after the outer table tag is processed.
The expression #{columnHeader.truncateAtPosition} returns the correct
value (not null) when it is placed in a h:outputtext tag.

But the same expression returns always null inside the converter tag.
<rm:truncateOutput truncateAt="#{columnHeader.truncateAtPosition}"
continuationMark="..."/>

Any ideas?
Is this caused due to different phases?

Michael

-----Original Message-----
From: Lindholm, Greg [mailto:glindholm@neom.com] 
Sent: Mittwoch, 12. April 2006 18:36
To: MyFaces Discussion
Subject: RE: tag to truncate outputText?

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:mhn@recommind.com] 
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()));
	}	





Mime
View raw message