0
我正在使用JSF。如何通過bean在jsf頁面中插入空間
我想在某些文本前插入一個空格,但它不起作用。
例:max_lenght = 8
字符串爲 「120.00」
的出認沽將成爲 「 120.00」
但它給 「120.00」 只有
我知道,使用&# 160;我們將增加空間,但我想通過bean添加。
Java代碼的
this.without_health_insurance_total_amount_as_String = d.format(this.without_health_insurance_total_amount);
if (this.without_health_insurance_total_amount_as_String.length() < max_lenght) {
this.without_health_insurance_total_amount_as_String = append_String(this.without_health_insurance_total_amount_as_String, max_lenght);
}
public String append_String(String source, int max_lenght) {
for (; source.length() < max_lenght;) {
source = new String(new StringBuffer(" ").append(source));
System.out.println(source);
}
return source;
}
XHTML:可
<h:outputText value="#{paymentreceipt.without_health_insurance_total_amount_as_String}" />
我想量打印到以下格式:
1,779.99
220.01
2,000.00
讓我通過輔助bean(上面的代碼)將3位爲220.01。
你試過逐字? http://www.jsftoolbox.com/documentation/help/12-TagReference/core/f_verbatim.html – Leo 2014-08-28 11:32:38
感謝您的快速回復..我沒有這樣做,讓我試試... – user2314868 2014-08-28 11:51:58
不,它不工作... – user2314868 2014-08-28 11:54:23