日期:2014-05-19  浏览次数:20601 次

struts2 s:property怎么输出百分比数字
从action中接受一个long格式的数字 ,在界面上怎么用百分比现实

------解决方案--------------------
在资源文件中定义日期及其数字的格式化,例如在classpath下新建一个.properties文件,起名为format.properties,内容如下
format.percent = {0,number,##0.00'%'}

用<s:text>进行引用
<s:i18n name="format">
<s:text name="format.percent " >
<s:param value="longValue"></s:param>
</s:text>
</s:i18n>

参见
http://www.blogjava.net/keweibo/articles/174997.html
struts2的匹配模式详情请见
http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html
------解决方案--------------------
探讨
在资源文件中定义日期及其数字的格式化,例如在classpath下新建一个.properties文件,起名为format.properties,内容如下
format.percent = {0,number,##0.00'%'}

用 <s:text>进行引用
            <s:i18n name="format">
                <s:text name="format.percent " >
                    <s:param value="longValue"> </s:param>   
                </s:text>
            </s:i18n>

参见
http://www.blogjava.net/keweibo/articles/174997.html
struts2的匹配模式详情请见
http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html

------解决方案--------------------
不管是struts2还是JSTL都有专门的格式化标签