实习小记3

1. freemarker中前端页面的 selecet标签

    <li class="normal" style="background:none;"><@s.select name="operatorName" list="allOperators" CssStyle="width:200px;"/></li>

    name 标签指定的operatorName,则对应的后台action中,有一个private operatorName,并拥有get set方法。

    list属性指定的allOperatorors是一个get方法,后台action中有public Map<String, String> getAllOperators()的get方法。此map中如果这样存放(id,name)。

   在页面中,如果在select中选择某个选项,点击提交,那么传递的是Key值,而不是value。在这里就是Id,而不是name。通过set方法,operatorName被设值注入为,所选下拉  框的值对应的Id。


2.


public PageItInfo<OperationLog> getObjectsByOperatorNameAndOperationAndLogTimeForPages(
            String operatorName, String operation,
            Timestamp logTime, long pageNum, int pageSize, String orderField,
            boolean isAsc) {
        DetachedCriteria detachedCriteria = DetachedCriteria
                .forClass(persistentClass);        
        
        if (logTime != null) {
            detachedCriteria.add(Restrictions.le("logTime", logTime));
        }
        if (!StringUtils.isBlank(operatorName)) {
            detachedCriteria
                    .add(Restrictions.eq("operatorName", operatorName));
        }
        if (!StringUtils.isBlank(operation)) {
            detachedCriteria.add(Restrictions.like("action", operation,MatchMode.ANYWHERE));
        }
        return joinGetObjectsForPage(detachedCriteria, pageNum, pageSize, new String[]{orderField}, new boolean[]{isAsc}, false, "");    
    }

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值