首先加入 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
- <c:if test= "${queryType == '1'}" >
- <c:if test="${ infoType == '0'}" >
- <div class="ttl_bar ttl_16" >南京一日游</div>
- </c:if>
- <c:if test="${ infoType == '1'}" >
- <div class="ttl_bar ttl_16" >南京周边游</div>
- </c:if>
- <c:if test="${ infoType == '2'}" >
- <div class="ttl_bar ttl_16" >境内游</div>
- </c:if>
- <c:if test="${ infoType == '3'}" >
- <div class="ttl_bar ttl_16" >境外游</div>
- </c:if>
- <c:if test="${ infoType == '4'}" >
- <div class="ttl_bar ttl_16" >自驾游</div>
- </c:if>
- </c:if>
利用传入的queryType的值判断显示的内容
其中<c:if test=""></c:if>中test的内容的结果只能是布尔值
另外判断时候为空:<c:if test="${empty id}">、<c:if test="${!empty id}">
本文通过使用JSP和JSTL(JavaServer Pages and JavaTag Library)动态生成页面内容,根据传入的参数queryType和infoType,展示不同类型的旅游推荐。展示了如何根据变量值的不同选择性地呈现特定的页面元素。


被折叠的 条评论
为什么被折叠?



