<c_rt:if test='<%= request.getParameter("p") != null %>'> <%= request.getParameter("p") %> </c_rt:if>
can be written as
<c:if test="${param.p != null}"> <c:out value="${param.p}" /> </c:if>
with expression language support enabled. More detailed information about the expression language is available at http://www.jcp.org/aboutJava/communityprocess/first/jsr052/index.html.
As mentioned in Using the Java Standard Tag Library (JSTL) in a JSPPage, there are four tag libraries that make up the JSTL. There are two versions of each of these libraries. That example declares the use of the four tag libraries that do not support the expression language. Here is an example that declares the use of the four tag libraries that do support the expression language:
<%-- Core with EL --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%-- I18N Formatting with EL --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%-- SQL with EL --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <%-- XML with EL --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %> <%-- JSTL functions with EL --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
No comments:
Post a Comment