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();

转载于:https://www.cnblogs.com/chenrunlin/p/4971641.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值