springMVC中利用model在JSTL进行回填值
1、ringMVC中利用model回填值
后台中,利用model返回值,如 model.addAttribute("MS_info" , MS_info);
前台回填值:
text : <input type="text" name="dangerousSourceName" class="input-text" size="50" value="${MS_info.dangerousSourceName}">
radio : <b><input type="radio" name="dangerousSourceType" value="锅炉" <c:if test="${MS_info.dangerousSourceType eq '锅炉'}"> checked</c:if> >锅炉</b>
select option :
<option <c:if test="${fn:contains(MS_info.dangerousSourceLevel,'一级')}"> selected="selected"</c:if> value="一级">一级</option>
<option <c:if test="${fn:contains(MS_info.dangerousSourceLevel,'二级')}"> selected="selected"</c:if> value="二级">二级</option>
textarea : <textarea rows="5" cols="50" name="ms_tailings.questionAndSolution">${ms_Tailings.questionAndSolution}</textarea>
checkbox : <input type="checkbox" <c:if test="${fn:contains(enterprise.companyProperty,'国有')}"> checked="checked" </c:if> name="companyProperty" value="国有">
有时候直接写<c:if test="${check.ck_duinfo == ''}">判断空会出错,本应为空,但结果却不为空,出现bug。这时用下面的写法
<c:if test="${empty check.ck_duinfo}"> check.ck_duinfo为空</c:if>
<c:if test="${not empty check.ck_duinfo}"> check.ck_duinfo不为空</c:if>
<c:forEach varStatus="status">中 varStatus的属性简介
${status.index} 输出行号,从0开始。
${status.count} 输出行号,从1开始。
</c:forEach>
//知道radio的值,让对应的radio选中
$("input[name='haveopinion'][value=有]").attr("checked",true);
//获取radio的值
var state = $('input[name="audit_pass_dept"]:checked').val();