例如,判断如果角色包含“正式员工”
<c:if test='${fn:contains(roleName,"正式员工")}'>
<li>
<a class="dropdown-toggle" href="#" onclick="addOneTab('我的投诉建议','octFeedbackRecordController.do?myApplication')">
<div id="" style="cursor:pointer;height: 70px; line-height: 60px;margin: 0 10px;">
<img src="webpage/images/main/feedback.png" alt="" style="border:none;">
<span style="color: #fff;">投诉与建议</span>
</div>
</a>
</li>
</c:if>
又例如
<td class="showTd_HK" align="center">
<c:if test="${(rwyy01.yyry==NULL || rwyy01.yyry=='') && (rwyy01.shry==NULL || rwyy01.shry=='') && (rwyy01.qrry==NULL || rwyy01.qrry=='')}">输入</c:if>
<c:if test="${(rwyy01.yyry!=NULL && rwyy01.yyry!='') && (rwyy01.shry==NULL || rwyy01.shry=='') && (rwyy01.qrry==NULL || rwyy01.qrry=='')}">预约</c:if>
<c:if test="${(rwyy01.shry!=NULL && rwyy01.shry!='') && (rwyy01.qrry==NULL || rwyy01.qrry=='')}">审核</c:if>
<c:if test="${rwyy01.qrry!=NULL && rwyy01.qrry!=''}">确认</c:if>
</td>
又例如
<td align="center" style="width: 107px;">
<select name="performanceList[${index.index}].leadbGrade" style="width:70px" >
<option value="">--请选择--</option>
<option value="A" <c:if test="${data.leadbGrade == 'A' }">selected="selected"</c:if>>A</option>
<option value="B" <c:if test="${data.leadbGrade == 'B' }">selected="selected"</c:if>>B</option>
<option value="C" <c:if test="${data.leadbGrade == 'C' }">selected="selected"</c:if>>C</option>
<option value="D" <c:if test="${data.leadbGrade == 'D' }">selected="selected"</c:if>>D</option>
</select>
因为在jsf要用到jstl标签,这里做有效的整理。在使用这些函数之前必须在JSP中引入标准函数的声明
<%@ taglib prefix=“fn” uri=“http://java.sun.com/jsp/jstl/functions” %>
下面是JSTL中自带的方法列表以及其描述
函数名 函数说明 使用举例
${fn:substringAfter(zip, “-”)}
substringBefore 获取从开始到某个字符所在位置的子串 ${fn:substringBefore(zip, “-”)}
toLowerCase 转为小写 ${fn.toLowerCase(product.name)}
toUpperCase 转为大写字符 ${fn.UpperCase(product.name)}
trim 去除字符串前后的空格 ${fn.trim(name)}