`

jsp和js取el表达式,及其表达式使用

 
阅读更多

1.js中用el表达式取参数

   var ar = "${xxbean.area }";

2.jsp中用el表达式取参数

   客户编号: ${xxbean.num }

3.常用el表达式

--------c:choose------------------

  <c:choose>

      <c:when test="${xxbean.area == 'LN'}"> 辽宁xxx</c:when>

      <c:when test="${xxbean.area == 'BJ'}"> 北京xxx</c:when>

     <c:otherwise></c:otherwise>

   </c:choose>

 

---------c:forEach------------------

varStatus则定义了一个循环状态变量var,属性为: index--当前循环索引号 ; count--成员总数 

<c:forEach items="${xxList}" var="xxxxs"  varStatus="s">

 <tr>

   <td>${s.index+1 }</td>

  <td>${xxxs.name }</td>

 </tr>

</c:forEach>

 

--------c:if------------------

 <c:if test="${user.userStatus=='no'}">

  未认证

 </c:if>

4.格式化

--------fmt:formatDate  格式化日期------------------

引入:<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

 <fmt:formatDate value="${xxx.x_date}" pattern="yyyy年MM月dd日 "/>

 

--------fmt:formatNumber  格式化金额---------------

引入:<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<fmt:formatNumber  value="${xxx.xx_money }" type="currency" pattern="#.00"/></td>

---------------------------------- 

5.js调用打印

   window.print(); 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics