前端汇总----Jsp 标签--forEach、choose、when、otherwise、fmt、if 包括 ajax、jQuery 等各种操作汇总《来自于英科》

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ywj776199845/article/details/84553935

jQuery

1.获取 下拉框的选中的value

<select title="还款类型" name="repaymentType" id="repaymentType">
			<c:forEach items="${ALL_REPAY_TYPE}" var="type">
					<option value="${type.key}">${type.value}</option>
			</c:forEach>
</select>



<!-- jQuery 获取: -->
var checkType=$("#repaymentType option:selected").val();

2.html textarea 标签使用

<textarea title="备注" name="remark" rows="5" cols="60" maxlength="50">${backUser.remark }</textarea>

3.函数互相调用

<script type="text/javascript">
	function submitFrm(){
		var checkType=$("#repaymentType option:selected").val();
		var checkNum=$("#orderId").val();	
		var trueRepaymentMoney = parseFloat($("#trueRepaymentMoney").val());
		
		if(trueRepaymentMoney <= 0){
			alertMsg.error('请输入有效的还款金额!');
			return false;
		}else if((checkType=='2'&&checkNum.length!=15)||(checkType=='3'&&checkNum.length!=15)){
			//富有和连连15位订单号
				alertMsg.error('请输入正确的订单号!');
				return false;
		}
		subRepay(trueRepaymentMoney); <!------------ 开始函数调用 --------------->
	}
	
	<!---------------------  被调用函数  --------------------------->
	function subRepay(trueRepaymentMoney){
		if(parseFloat("${remainMoney}") < trueRepaymentMoney){
			if(confirm('还款金额大于剩余待还金额,确定继续操作还款?')){
				$("#frm").submit();
				return;
			}else{
				return false;
			}
		}
		$("#frm").submit();
	}
	
</script>

1.c:if 标签

​
<table class="searchContent">
	<tr>
		<td>资金类型: 
			<select name="repayChannel"  id="repayChannel">
			    <option value="">全部</option>
	                    <option <c:if test="${params.repayChannel eq 1}">selected="selected"</c:if> value="1" name="repayChannel" value="${params.repayChannel }">本息</option>
			    <option <c:if test="${params.repayChannel eq 2}">selected="selected"</c:if> value="2" name="repayChannel" value="${params.repayChannel }">补利息</option>
			    <option <c:if test="${params.repayChannel eq 3}">selected="selected"</c:if> value="3" name="repayChannel" value="${params.repayChannel }">本金</option>
			</select>
		</td>
	</tr>
</table>

​<td align="center">
		<c:if test="${rec.repayKoudaiType==0}">待处理</c:if>
		<c:if test="${rec.repayKoudaiType==1}">待还</c:if>
		<c:if test="${rec.repayKoudaiType==2}">正常还款</c:if>
		<c:if test="${rec.repayKoudaiType==3}">担保户垫付</c:if>
		<c:if test="${rec.repayKoudaiType==4}">担保户垫付待还</c:if>
		<c:if test="${rec.repayKoudaiType==5}">问题还款</c:if>
		<c:if test="${rec.repayKoudaiType==6}">异常订单</c:if>
</td>

2.forEach、choose、when、otherwise、fmt

<c:forEach var="borrow" items="${pm.items }" varStatus="status" >
                    <tr>
                        <td align="center">${borrow.lateday}</td>
                        <td align="center"><fmt:formatDate value="${borrow.orderTime }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                        <td align="center">
                            <c:choose>
                                <c:when test="${ null != borrow.repaytime }">
                                    <fmt:formatDate value="${borrow.repaytime }" pattern="yyyy-MM-dd HH:mm:ss"/>
                                </c:when>
                                <c:otherwise>
                                    ---
                                </c:otherwise>
                            </c:choose>
                        </td>
                        <td align="center">
                            <c:choose>
                                <c:when test="${null != borrow.repayrtime}">
                                    <fmt:formatDate value="${borrow.repayrtime }" pattern="yyyy-MM-dd HH:mm:ss"/>
                                </c:when>
                                <c:otherwise>
                                    ---
                                </c:otherwise>
                            </c:choose>
                        </td>
                        <td align="center"> ${statusMap[borrow.status] }</td>
                    </tr>
                </c:forEach>

猜你喜欢

转载自blog.csdn.net/ywj776199845/article/details/84553935