el表达式与标签的联合各种使用方法记录

时间:2021-03-03 13:22:26

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

1、

<select class="form-control"  id="createTableType1" name="createTableType1" >

  <option <c:choose><c:when test="${sysTableColumn.fieldType=='NUMBER' || sysTableColumn.fieldType=='number'}">selected</c:when>                     <c:otherwise></c:otherwise></c:choose> value="NUMBER">NUMBER</option>
  <option <c:choose><c:when test="${sysTableColumn.fieldType=='VARCHAR2' || sysTableColumn.fieldType=='varchar2'}">selected</c:when>                  <c:otherwise></c:otherwise></c:choose> value="VARCHAR2">VARCHAR2</option>
  <option <c:choose><c:when test="${sysTableColumn.fieldType=='DATE' || sysTableColumn.fieldType=='date'}">selected</c:when><c:otherwise>                </c:otherwise></c:choose> value="DATE">DATE</option>
</select>

2、

<c:if test="${sysTableColumn.fieldType=='VARCHAR2' || sysTableColumn.fieldType=='varchar2'}">
    <option value="${sysTableColumn.fieldType}">${sysTableColumn.fieldType}</option>
    <option value="NUMBER">NUMBER</option>
    <option value="DATE">DATE</option>
</c:if>

3、

<button type="button" class="btn btn-primary" id="<c:choose><c:when test="${empty sourceID}">addComeBack</c:when>                                                <c:otherwise>editComeBack</c:otherwise></c:choose>">返回</button>