每日记载内容总结2
1.部分css内容
border-collapse:collapse border-collapse 属性设置表格的边框是否被合并为一个单一的边框 colspan colspan 属性规定单元格可横跨的列数。
2.jsp里面加入java代码实现select的option
<select name="bookTypeId"> <% List<BookType> bookType=(List<BookType>)request.getAttribute("bookType"); for(BookType bookType : bookTypes) { %> <option values="<%=bookType.getBokkTypeId()%>"><%=bookType.getBookTypeId()%></option> <%}%> </select>
3.根据java传值判断checkbox是否选中
var displayPrice=$("#displayPrice").attr("value"); if(displayPrice=="Y"){ $("#displayPrice").attr("checked",true); }else{ $("#displayPrice").attr("checked",""); }
4.select判断传入值并设置默认值
<select name="condition" id="condition"> <option value="1" ${productBean.condition== "1" ? 'selected' : '' }>NEW</option> <option value="2" ${productBean.condition== "2" ? 'selected' : ''}>USED</option> </select>
5.在select中用foreach接受传入的list并设置默认值
<select class="manufac" name="manufName" id="manufName"> <c:forEach items="${manufacturers}" var="manuf" varStatus="status"> <option value="${manuf.manufacturerId}" ${productBean.manufacturerId eq manuf.manufacturerId ? "selected='selected'" : ""}> ${manuf.manufacturerName}</option> </c:forEach> </select>