[
https://issues.apache.org/jira/browse/MYFACES-1739?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Leonardo Uribe updated MYFACES-1739:
------------------------------------
Status: Patch Available (was: Open)
> JSR-252 Issue #13: needs converter-for-class converter registration for
> BigDecimal and BigInteger
> --------------------------------------------------------------------------------------------------
>
> Key: MYFACES-1739
> URL: https://issues.apache.org/jira/browse/MYFACES-1739
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-252
> Environment: Tomcat 6.0.14, Myfaces 1.2.1-SNAPSHOT
> Reporter: Leonardo Uribe
> Fix For: 1.2.1-SNAPSHOT
>
> Attachments: patchBigIntegerBigDecimal.patch
>
>
> When you have this code:
> <%@ page session="false" contentType="text/html;charset=utf-8"%>
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <html>
> <f:view>
> <[EMAIL PROTECTED] file="inc/head.inc"%>
> <body>
> <f:loadBundle
> basename="org.apache.myfaces.examples.resource.example_messages"
> var="example_messages" />
> <h1>Myfaces Examples JSF 1.2 Additions</h1>
> <h:messages></h:messages>
> <h:form id="form">
> <h:panelGrid id="grid" columns="3">
> <h:outputLabel value="BigInt"
> for="bigint"></h:outputLabel>
> <h:inputText id="bigint"
> value="#{convertBigBean.bigint}">
> <f:converter
> converterId="javax.faces.BigInteger" />
> </h:inputText>
> <h:message for="bigint"></h:message>
> <h:outputLabel value="BigDecimal"
> for="bigdecimal"></h:outputLabel>
> <h:inputText id="bigdecimal"
> value="#{convertBigBean.bigdecimal}">
> <f:converter
> converterId="javax.faces.BigDecimal" />
> </h:inputText>
> <h:message for="bigdecimal"></h:message>
> </h:panelGrid>
> <h:commandButton id="button1" value="press me" action="update"
> />
> </h:form>
> </body>
> </f:view>
> </html>
> And the backing bean looks like follows:
> package org.apache.myfaces.convertbig;
> import java.math.BigDecimal;
> import java.math.BigInteger;
> public class ConvertBigBean {
> private BigInteger bigint;
>
> private BigDecimal bigdecimal;
> public BigInteger getBigint() {
> return bigint;
> }
> public void setBigint(BigInteger bigint) {
> this.bigint = bigint;
> }
> public BigDecimal getBigdecimal() {
> return bigdecimal;
> }
> public void setBigdecimal(BigDecimal bigdecimal) {
> this.bigdecimal = bigdecimal;
> }
>
> }
> The code works but if you remove the lines:
> <f:converter converterId="javax.faces.BigInteger" />
> and
> <f:converter converterId="javax.faces.BigDecimal" />
> works in JSF RI 1.2 but not on Myfaces 1.2 as the spec says.
> This issue is related with MYFACES-1260 JSR-252 Issue #13: Specified "by
> type" converter registration for BigDecimal and BigInteger, but this is closed
> so I open a new issue. The solution is simple, just add the following:
> <converter>
> <converter-for-class>java.math.BigDecimal</converter-for-class>
> <converter-class>javax.faces.convert.BigDecimalConverter</converter-class>
> </converter>
> and
> <converter>
> <converter-for-class>java.math.BigInteger</converter-for-class>
> <converter-class>javax.faces.convert.BigIntegerConverter</converter-class>
> </converter>
> to the files BigInteger.xml and BigDecimal.xml of myfaces-build project on
> 1.2 branch
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.