我有以下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 "
如何加入字符串?
您可以使用 String.concat 函数:
<af:outputText value="#{viewArticle.publish ? 'Publish on '.concat(viewArticle.publishDate).concat(' by ').concat(viewArticle.publishFirstName).concat(' ').concat(viewArticle.publishLastName) : 'Draft version'}"/>