JSTL常用表达式

1.普通变量
${member.password }

通过jsp页面传值:

${param.userId}

2.判断(判空)

	        <c:if test="${not empty member}">
	         <dl>
	        	<dt>
	            	<label for="title">密码:</label>
	            </dt>
	            <dd>
	            	<input type="password" class="half" id="password" name="password" value="${member.password }" tabindex="1" maxlength="11"></input>
	            </dd>
	        </dl>	
	        </c:if>

3.

<c:if test="${member.meetingMember.mobileIsDisplay eq 1 }">selected="selected"</c:if>

4.

${fn:substring(member.birthday,0,10)}


5.判断 循环

<c:choose>
				<c:when test="${not empty pager.pageRecords}">
					<c:forEach var="user" items="${pager.pageRecords}" varStatus="status">
						<tr <c:if test="${status.count % 2 eq 0}"> class="even"</c:if>>
							<td><input type="checkbox" name="userId" value="${user.id}"></input></td>
							<td><a href="##" οnclick="editUser(${user.id })">${user.mobile }</a></td>
							<td>${user.name }</td>
							<c:choose>
							<c:when test="${user.meetingMember.addInContacts eq 'N'}"><font style="color:red;">不加入</font></c:when>
							<c:when test="${user.meetingMember.addInContacts eq 'Y'}">加入</c:when>
							<c:otherwise><font style="color:red;">未设定</font>	</c:otherwise>
							</c:choose>
							</td> 
							<td >
								<c:choose>
									<c:when test="${user.meetingMember.mobileIsDisplay eq 1}">显示</c:when>
									<c:otherwise><font style="color:red;">不显示</font></c:otherwise>
								</c:choose>
							</td>
																		</tr>
					</c:forEach>
				</c:when>
				<c:otherwise>
					<tr class="datarow"><td colspan="11" align="center"> 无用户信息.</td></tr>
				</c:otherwise>
			</c:choose>
6.
	<c:choose>
				<c:when test="${meetingFile.filePostfix=='JPG'}"><img width="16" height="16" alt="${meetingFile.filePostfix}"
					title="${meetingFile.filePostfix}" src="${ctx}/images/file/filetype/jpg.gif"></c:when>
				<c:when test="${meetingFile.filePostfix=='DOC'}"><img width="16" height="16" alt="${meetingFile.filePostfix}"
					title="${meetingFile.filePostfix}" src="${ctx}/images/file/filetype/word.gif"></c:when>
				
				
				<c:otherwise>
					<img width="16" height="16" alt="${meetingFile.filePostfix}" title="${meetingFile.filePostfix}" src="${ctx}/images/file/filetype/other.gif">
				</c:otherwise>
				</c:choose>

7.格式化时间

<fmt:formatDate value="${entity.sendTime}"  type="both"  pattern="yyyy-MM-d HH:mm:ss"/>

8.赋值

	<c:set var="userId" value="${user.id},"/>

9:是否包含contains

<c:if test="${fn:contains(recieverIds,user.id)}"> checked="checked" </c:if> 

10:判断数组的大小

${fn:length(userList)}
<c:if test="${fn:length(guest.about)>10}">
11.

${fn:startsWith(view.date, today)}
${fn:substringBefore(meetingagenda.startTime,':')}
${fn:substringBefore(meetingagenda.startTime,':')}
fn:toLowerCase(meetingFile.filePostfix)

12

${fn:escapeXml(meeting.name)}





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值