BigDecimal form field problem

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

BigDecimal form field problem

Chris Cheshire
Using Stripes 1.5.7, I have an action bean to process a form. One
field is a BigDecimal. When it has a small value (in this case
0.00013450), it is being displayed as 0 when used in conjunction with
a stripes text box, text area or even hidden field :

<stripes:text name="btcCost" size="20" />

If I use JSP-EL, ${actionBean.btcCost}, to display it on the page, I
get the correct value. If I use vanilla html code and JSP-EL to grab
the value from the action bean, I get the right value in the field.

It initially saved the correct value via the form, but any attempts to
present it are failing, even though the accessor is returning the
right value.

Is there anything special I need to do (other than reverting to
vanilla html) to get BigDecimal form fields working?

Chris

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: BigDecimal form field problem

Mike McNally-3
You can tell Stripes how to format the field value via the
"formatType" and "formatPattern" attributes of <s:text>.  The type in
your case would probably be "number", and the pattern would be either
a resource key for a pattern stored as a Stripes property, or else a
raw java.text.MessageFormat pattern.

On Fri, Mar 15, 2013 at 2:10 PM, Chris Cheshire <[hidden email]> wrote:

> Using Stripes 1.5.7, I have an action bean to process a form. One
> field is a BigDecimal. When it has a small value (in this case
> 0.00013450), it is being displayed as 0 when used in conjunction with
> a stripes text box, text area or even hidden field :
>
> <stripes:text name="btcCost" size="20" />
>
> If I use JSP-EL, ${actionBean.btcCost}, to display it on the page, I
> get the correct value. If I use vanilla html code and JSP-EL to grab
> the value from the action bean, I get the right value in the field.
>
> It initially saved the correct value via the form, but any attempts to
> present it are failing, even though the accessor is returning the
> right value.
>
> Is there anything special I need to do (other than reverting to
> vanilla html) to get BigDecimal form fields working?
>
> Chris
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Turtle, turtle, on the ground,
Pink and shiny, turn around.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: BigDecimal form field problem

Chris Cheshire
Ahh that works, thanks :)

So as an aside, is the number converter defaulting to an int/long
representation causing the display of 0?

On Fri, Mar 15, 2013 at 3:15 PM, Mike McNally <[hidden email]> wrote:
> You can tell Stripes how to format the field value via the
> "formatType" and "formatPattern" attributes of <s:text>.  The type in
> your case would probably be "number", and the pattern would be either
> a resource key for a pattern stored as a Stripes property, or else a
> raw java.text.MessageFormat pattern.
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: BigDecimal form field problem

Mike McNally-3
Well I *think* it uses the default format for the effective locale.

On Fri, Mar 15, 2013 at 2:37 PM, Chris Cheshire <[hidden email]> wrote:

> Ahh that works, thanks :)
>
> So as an aside, is the number converter defaulting to an int/long
> representation causing the display of 0?
>
> On Fri, Mar 15, 2013 at 3:15 PM, Mike McNally <[hidden email]> wrote:
>> You can tell Stripes how to format the field value via the
>> "formatType" and "formatPattern" attributes of <s:text>.  The type in
>> your case would probably be "number", and the pattern would be either
>> a resource key for a pattern stored as a Stripes property, or else a
>> raw java.text.MessageFormat pattern.
>>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> Stripes-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-users



--
Turtle, turtle, on the ground,
Pink and shiny, turn around.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users