我试图在状态完成时使用<c:if>来有条件地在<h:dataTable>放置一个<h:outputLink> 。 <h:dataTable value="#{bean.items}" var="item" width="80%"> <h:column> <f:facet name="header"> <h:outputText value="State" /> </f:facet> <c:if test="#{item.state != 'Finish'}"> <h:outputText value="Missing value" /> </c:if> <c:if test="#{item.state == 'Finish'}"> <h:outputLink value="myLink"> <h:outputText value="Value = #{item.state}" /> </h:outputLink> </c:if> </h:column> </h:dataTable> 但是这不起作用,为什么是这样,我该如何解决?
我不知道我做错了什么,但是我不能包括JSTL。 我有jstl-1.2.jar,但不幸的是我得到exception: org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116) at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315) at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:429) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1439) at org.apache.jasper.compiler.Parser.parse(Parser.java:137) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255) at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) […]
我想有条件地输出一些Facelets代码。 为此,JSTL标签似乎工作正常: <c:if test="${lpc.verbose}"> … </c:if> 但是,我不确定这是否是最佳做法? 有另一种方法来实现我的目标?
我的servlets / jsp web应用程序存在一个小问题。 我试图在jsp页面中使用jstl。 当我使用任何标签例如: <c:out value="${command}"/> 它显示了我 ${command} 在我的浏览器中,而不是参数'命令'的值。 我正在使用maven(我猜这个问题在这里)。 这里是pom的xml依赖关系: <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> 我的web.xml声明标签: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 和jsp部分: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <head> <title>Parsing results</title> <link type="text/css" rel="stylesheet" href="css/page.css"/> <link type="text/css" rel="stylesheet" href="css/table.css"/> </head> […]