struts2 标签自定义数值处理
来源:互联网 发布:陕西师大网络教育首页 编辑:程序博客网 时间:2024/06/05 07:32
为了在页面上对分数进行处理,将 诸如20.0 的Double型 去掉 “.0”,转换为形如“20”的形式,采用了网上查到的一种方式,在相应的Action中添加了一个方法,在jsp页面的s标签中直接调用即可,如下:
//对double类型的数值进行格式化
public String formatDouble(double s){
String result = String.valueOf(s);
int index = result.indexOf(".0");
if(index > 0){
result = result.substring(0, index);
}
return result;
}
每题 <s:property value="formatDouble(allQuestionList.{sscore}[0])"/> 分
0 0
- struts2 标签自定义数值处理
- Struts2 标签自定义格式显示数值、日期
- Struts2自定义时间标签
- Struts2自定义标签
- struts2 自定义标签
- struts2 自定义标签
- struts2自定义分页标签
- struts2自定义分页标签
- Struts2自定义分页标签
- struts2自定义分页标签
- Struts2 自定义标签
- struts2 自定义标签 实例
- struts2 自定义标签 实例
- struts2自定义分页标签
- 自定义Struts2翻页标签
- Struts2自定义简单标签
- struts2 自定义标签
- 自定义Struts2简单标签
- Phalcon Hello World Benchmark(Hello World测试)
- 如何给超链接设置宽度和高度
- 性能优化需要注意的点
- 关键字 + 常量 + 变量 类型转换 负数
- 因为理想,所以改变世界
- struts2 标签自定义数值处理
- Android开发之InstanceState详解
- android am pm命令
- Python如何将一个矩阵保存到一个列表中,再读出来
- 运维监控利器Nagios:概念、结构和功能
- 去哪儿2015笔试题:寻找字符串的差异
- [LeetCode][I]Permutations II
- Spring 注解学习手札(七) 补遗——@ResponseBody,@RequestBody,@PathVariable
- 缓存概述