What is the correct way of doing conditional output?

This

<h:outputText value="#{payee.discriminatorValue=='P' ? payee.firstName:' '}"/>

works , and yet this

<h:outputText value="#{payee.discriminatorValue=='P' ? ' ':payee.orgRegistrationNumber}"/>

fails with the following parse error :

SEVERE: Error Rendering View[/claimantresult.xhtml]

com.sun.facelets.tag.TagAttributeException: /claimantresult.xhtml @158,103 value="#{payee.discriminatorValue=='P' ? ' ' :payee.orgRegistrationNumber}" Error Parsing: #{payee.discriminatorValue=='P' ? ' ' :payee.orgRegistrationNumber}

at com.sun.facelets.tag.TagAttribute.getValueExpression(TagAttribute.java:259)

.............

............

....

Caused by: javax.el.ELException: Error Parsing: #{payee.discriminatorValue=='P' ? ' ' :payee.orgRegistrationNumber}

at com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:160)

at com.sun.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:177)

at com.sun.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:221)

at com.sun.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:81)

at org.jboss.seam.ui.facelet.SeamExpressionFactory.createValueExpression(SeamExpressionFactory.java:107)

at com.sun.facelets.tag.TagAttribute.getValueExpression(TagAttribute.java:256)

... 61 more

Caused by: com.sun.el.parser.ParseException: Encountered ":payee" at line 1, column 39.

Was expecting one of:

"." ...

"[" ...

":" ...

">" ..

[1668 byte] By [jmutonhoa] at [2007-11-27 1:24:20]
# 1

Which JSF version?

Try gently using spaces after the colon:<h:outputText value="#{payee.discriminatorValue == 'P' ? ' ' : payee.orgRegistrationNumber}"/>

And if this doesn't help, what about:<h:outputText value="#{payee.discriminatorValue != 'P' ? payee.orgRegistrationNumber : ' '}"/>

Or just<h:outputText value="#{payee.orgRegistrationNumber}" rendered="#{payee.discriminatorValue != 'P'}" />

BalusCa at 2007-7-12 0:15:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...