42

我有以下 el 表达式:

<af:outputText value="#{viewArticle.publish ? ('Publish on ' + viewArticle.publishDate + ' by ' + viewArticle.publishFirstName + ' ' + viewArticle.publishLastName) : 'Draft version'}"/>

但我越来越

java.lang.NumberFormatException: For input string: "Publish on "

如何加入字符串?

4

3 回答 3

82

您可以使用String.concat函数:

<af:outputText value="#{viewArticle.publish ? 'Publish on '.concat(viewArticle.publishDate).concat(' by ').concat(viewArticle.publishFirstName).concat(' ').concat(viewArticle.publishLastName) : 'Draft version'}"/>

于 2013-11-04T22:38:18.070 回答
41

你应该写

value  = "#{someBean.aProperty}  something you want in between #{someBean.anotherProperty}"
于 2013-06-14T06:50:04.973 回答
3

You have to write a custom EL function. This example will help you :)

于 2013-06-14T13:02:55.457 回答