zoukankan      html  css  js  c++  java
  • 从控制层传三个及以上不同类型的值到页面

    方法一:封装成一个临时实体类。

    方法二:将这些值用json(JSONObject)转换成字符串形式,然后在通过json(JSON.parse)转换成Map,放入Map或List集合中。

    例:1.控制层

    Map<String,Map<String,String>> maps=new
    HashMap<String,Map<String,String>>();
    for (CoinProps newCoins : digtalCoinsNew) {
    	boolean isFixedTimeLimit = limitService.isLimitCoinType(newCoins);
    	String coinName = newCoins.getEnname();
    	if ( isFixedTimeLimit ){
    		fixedTimeLimitCoins.append(fixedTimeLimitCoins.length() > 0 ? "," : "").append(coinName);
    	}
    	UserWithdrawLimit uwl = uwlDao.getByUser(userId, newCoins);
    	JSONObject json = new JSONObject();
    	json.put("name", coinName);
    	json.put("timeLimit", isFixedTimeLimit);
    	json.put("withdrawLimit", uwl);
    	String string = json.toString();
    	Map map=(Map)com.alibaba.fastjson.JSON.parse(string);
    	maps.put(coinName, map);
    }
    

      2.页面

    <c:forEach items="${limit }" var="limit">
    <c:if test="${ !limit.value.timeLimit }">
          <span class="s2">
              ${limit.value.name }单笔限额:<em class="green"><fmt:formatNumber value="${limit.value.withdrawLimit.everyTimeAmount}" pattern="#.##"/></em>
              <a href="javascript:dayCashNew('${user.id}','everyTimeAmount','${limit.value.name }','${limit.value.withdrawLimit.userId}')"> 修改</a>
          </span>
          <span class="s2">
              ${limit.value.name }单日限额:<em class="green"><fmt:formatNumber value="${limit.value.withdrawLimit.everyDayAmount}" pattern="#.##"/></em>
              <a href="javascript:dayCashNew('${user.id}','everyDayAmount','${limit.value.name }','${limit.value.withdrawLimit.userId}')"> 修改</a>
            </span>
    </c:if>
    </c:forEach>
    

      3.附

    @Entity
    public class UserWithdrawLimit extends StrBaseLongIdEntity {
    
        private static final long serialVersionUID = -2386115543279873656L;
        /**当为0时,表示默认全局设置*/
        private int userId;
        /**币种类型,参见CoinProps的fundsType*/
        private int fundsType;
        /**单笔提现额度*/
        private String everyTimeAmount;
        /**单日提现额度*/
        private String everyDayAmount;
        /**单日免审提币额度*/
        private String dayFreeCash;
       
        public UserWithdrawLimit() {
        }
    
        public UserWithdrawLimit(Datastore ds) {
            super(ds);
        }
      
        .........
    

      

  • 相关阅读:
    分享一个Fluent风格的邮件发送封装类
    写一个ActionFilter检测WebApi接口请求和响应
    一道有趣的面试题,小鸟和火车的问题
    Centos7 查看Mysql配置文件
    Centos7 grep命令简介
    Centos7 网络配置
    django之python3.4及以上连接mysql的一些问题记录
    NetCore log4net 集成以及配置日志信息不重复显示或者记录
    ionic3中关于Ionic ui component使用的一些总结
    ionic2升级到ionic3并打包APK
  • 原文地址:https://www.cnblogs.com/heinight/p/7373695.html
Copyright © 2011-2022 走看看