This question already has an answer here:
How to concatenate Strings in EL expression?
(1个答案)
5年前关闭。
我有以下el表达式:
但是我越来越
如何加入字符串?
(1个答案)
5年前关闭。
我有以下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'}"/>
08-04 14:50