Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在xHtml的IF-Else语句中插入HTML代码?_Java_Jsf_If Statement_Primefaces - Fatal编程技术网

Java 如何在xHtml的IF-Else语句中插入HTML代码?

Java 如何在xHtml的IF-Else语句中插入HTML代码?,java,jsf,if-statement,primefaces,Java,Jsf,If Statement,Primefaces,我的页面上有primefaces数据表 我在我的栏上显示了两个数字 我喜欢这样: #{pushNotification.status==1? 'FINISHED' : 'STOP'} *// If the data == 1 show 'FINISHED' else show 'STOP'* 但我想在if语句中运行HTML代码,而不仅仅是文本 我试过这样做 #{pushNotification.status==1? '<a>FINISHED</a>' : 'STO

我的页面上有primefaces数据表

我在我的栏上显示了两个数字

我喜欢这样:

 #{pushNotification.status==1? 'FINISHED' : 'STOP'}
 *// If the data == 1 show 'FINISHED' else show 'STOP'*
但我想在if语句中运行HTML代码,而不仅仅是文本

我试过这样做

 #{pushNotification.status==1? '<a>FINISHED</a>' : 'STOP'}
完成
停止

同时添加xmlns:ui=”http://java.sun.com/jsf/facelets“在html标记中

这与el表达式的问题无关。您可以尝试以下操作:#{pushNotification.status='1'?'FINISHED':'STOP'}我知道它可以工作。但我想在if或else语句中运行html代码。
javax.el.ELException: EL Expression Unbalanced: ... #{pushNotification.status==1? '' : 'STOP' '
at com.sun.faces.facelets.el.ELText.findVarLength(ELText.java:428)
at com.sun.faces.facelets.el.ELText.parse(ELText.java:373)
at com.sun.faces.facelets.el.ELText.parse(ELText.java:325)
at com.sun.faces.facelets.compiler.TextUnit.flushTextBuffer(TextUnit.java:139)
at com.sun.faces.facelets.compiler.TextUnit.addInstruction(TextUnit.java:127)
at com.sun.faces.facelets.compiler.TextUnit.startTag(TextUnit.java:197)
at com.sun.faces.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:313)
at com.sun.faces.facelets.compiler.SAXCompiler$CompilationHandler.startElement(SAXCompiler.java:247)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
<ui:fragment rendered="#{pushNotification.status == 1}">FINISHED</ui:fragment>
<ui:fragment rendered="#{pushNotification.status != 1}">STOP</ui:fragment>