English 中文(简体)
最大分类
原标题:maxIntegerDigits of jsf convertNumber

I ve got strange problem with <f:convertNumber>. When i set maxIntegerDigits to 15 and enter, say, 16 of "1"s, i get correct number with fifteen "1"s, but if i enter 20 of "1"s i get not a number with fifteen "1"s but a number with 11 "1"s and 4 "0"s, i.e. 111111111110000, and the more digits i enter the less significant numbers and the more zeros i get. Why?
Here s code snippet:

<a4j:region>
    <h:inputText id="numValue" value="#{MyBean.valueN}">
        <a4j:support event="onchange" limitToList="true" ajaxSingle="true" reRender="numValue"/>
        <f:convertNumber groupingUsed="false" type="number" maxIntegerDigits="15" minFractionDigits="0"/>
    </h:inputText>
</a4j:region>

MyBean.valueN is java.lang.Double.

问题回答

这符合ISO 754浮动点号的性质。 <代码>杜布尔<>/代码>的最大值是<编码>1.7976931348623157e308,其精准性在于此。 超出这种分类精度的任何东西都将四舍五入。

请使用<代码>javamath。 BigDecimal. 您的<代码><f:convertNumber>将照样工作。





相关问题
JSF a4j:support with h:selectManyCheckbox

I m having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 ...

Mojarra for JSF Encoding

Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

如何拦截要求终止?

在共同基金中,如果用户要求终止,就需要采取一些行动。 我需要某种拦截器,但我不知道如何这样做。 我需要帮助。 增 编

ICEFaces inputFile getting the file content without upload

Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading ...

Weird behaviour of h:commandLink action (MethodExpression)

I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

热门标签