实习小记3
2016-07-13 14:15
211 查看
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, "");
}
<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, "");
}
相关文章推荐
- UVA - 10387 Billiard
- HDOJ 1275 两车追及或相遇问题
- MySQL学习系列(2) -- MySQL数据库生产环境的安装和升级
- EventBus事件总线分发库
- UVA - 375 Inscribed Circles and Isosceles Triangles
- MongoDB Wiredtiger存储引擎实现原理
- UVA - 579 Clock Hands
- 原生js仿jquery animate动画效果
- linux源码包与RPM包的区别
- UVA - 10250 The Other Two Trees
- 自定义的textView
- WebView与JavaScript的交互
- JSP网页处理过程
- UVA - 10879 Code Refactoring
- spring boot
- UVA - 10392 Factoring Large Numbers
- MySQL:常用操作符、管理命令、基本SQL语法等
- UVA - 350 Pseudo-Random Numbers
- UVA - 408 Uniform Generator
- 赫夫曼树