[
http://www.stripesframework.org/jira/browse/STS-846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12601#comment-12601
]
Ben Gunter commented on STS-846:
--------------------------------
I'm inclined to side with Iwao here. The behavior when validation errors are
present is to present the form with the inputs filled out exactly as the user
entered them. For a double field, that could include all kinds of invalid
stuff: too many decimals, letters, emoticons, copyright symbols ... whatever
they put in is what's going to come back.
When you forward to the JSP with the value already present in the ActionBean
property, the NumberFormatter is responsible for formatting to your
specification what it already knows is a valid number. By default, it just uses
whatever is returned by java.text.NumberFormat.getInstance(Locale). That is
what causes the truncation to 3 decimal places. I really don't know why that's
the default behavior, but that's what it is.
In my opinion, this isn't a bug; it's just default behavior that you don't
agree with. (And that's OK; you could make a good argument against this
behavior as the default.) But that doesn't mean it's a bug. This behavior is
easy to override, and after all these years I don't think we ought to tinker
with it.
> Strange behavior with Double fields
> -----------------------------------
>
> Key: STS-846
> URL: http://www.stripesframework.org/jira/browse/STS-846
> Project: Stripes
> Issue Type: Bug
> Components: Formatting
> Affects Versions: Release 1.5.6
> Reporter: Samuel Santos
> Assignee: Ben Gunter
> Priority: Critical
>
> I have a strange behavior with fields using the type Double.
> If I submit a form with a double field in it and get a validation error (e.g.
> a different required field that is missing), the input is populated with the
> exact value that I have inserted (e.g. 3.123456789).
> But if I do not trigger a validation error and forward to the same JSP page,
> the input is populated with the right value but trimmed to only 3 decimal
> cases (e.g. 3.123).
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development