一、c标签
if…else…
<c:choose>
<c:when test="${shopProduct == ''}">
<input type="hidden" class="form-control" name="productid" value="">
</c:when>
<c:otherwise>
<input type="hidden" class="form-control" name="productid" value="${shopProduct.productid }">
</c:otherwise>
</c:choose>
select
<select id="cateid" name="cateid" class="form-control" style="width:205px">
<option value="">---请选择---</option>
<c:forEach items="${shopCategoryList}" var="shopCategoryList" varStatus="row">
<c:choose>
<c:when test="${shopCategoryList.cateid eq shopProduct.cateid}">
<option value="${shopCategoryList.cateid}" selected="selected">${shopCategoryList.title }</option>
</c:when>
<c:otherwise>
<option value="${shopCategoryList.cateid}">${shopCategoryList.title}</option>
</c:otherwise>
</c:choose>
</c:forEach>
</select>
radio
<c:if test="${shopProduct.issale=='1'}">
<input checked="checked" type="radio" class="form-control" name="issale" id="issale1" value="1"> <label for="issale1" style="display: inline;">是</label>
<input type="radio" class="form-control" name="issale" id="issale0" value="0"> <label for="issale0" style="display: inline;">否</label>
</c:if>
<c:if test="${shopProduct.issale=='0'}">
<input type="radio" class="form-control" name="issale" id="issale1" value="1"> <label for="issale1" style="display: inline;">是</label>
<input checked="checked" type="radio" class="form-control" name="issale" id="issale0" value="0"> <label for="issale0" style="display: inline;">否</label>
</c:if>
使用以下方式,需要注意数据库存储的类型不要是char,enum
<input type="radio" name="emp.sex" value="1" <c:if test="${info.sex=='1'}" 'checked'/>/>男
<input type="radio" name="emp.sex" value="1" <c:if test="${info.sex==0}" 'checked'/>/>女
全CSDN的丰(好)色(se)博客,这里有书本看不到的Java技术,电影院禁播的电影,欢迎关注QQ群494808400