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="##" onclick="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)}





你可能感兴趣的:(c,user,Class,input)