Re: conversion error repopulation not working

2012-05-31 Thread Łukasz Lenart
I'll add this code as an additional example, but I'm wondering is it a good way to base on fieldErrors as they can be also populated by validators. Maybe adding ConversionAware interface with specific method to populate conversionErrors would be better ? Then I could extend ActionSupport with getF

Re: conversion error repopulation not working

2012-05-31 Thread J. Garcia
This works nicely. Thanks! Cheers, J. On Thu, May 31, 2012 at 3:07 PM, Łukasz Lenart wrote: > Can be reduced to this: > > public String getFormatted(String key, String fieldName, List args) { > if (getFieldErrors().isEmpty()) { > return getText(key, args); > } else { >

Re: conversion error repopulation not working

2012-05-31 Thread Łukasz Lenart
Can be reduced to this: public String getFormatted(String key, String fieldName, List args) { if (getFieldErrors().isEmpty()) { return getText(key, args); } else { return ActionContext.getContext().getValueStack().findString(defaultValue); } } and it wor

Re: conversion error repopulation not working

2012-05-31 Thread Łukasz Lenart
2012/5/31 J. Garcia : > The short-circuiting option sounds good. There could even be a specially > dedicated getText() (or alternative method name) for this scenario, which > should be rather frequent in l10n apps. Not the best solution, but works: and in ExampleAction (or any other base action

Re: conversion error repopulation not working

2012-05-31 Thread Łukasz Lenart
2012/5/31 Łukasz Lenart : > Ok, looks like a problem is with getText() in jsp but I think there is > no other way ... you can use String instead and check for errors in > getter/setter but I'm not sure if it does the trick The problem is a bit complicated here as getText(String key, String[] args)

Re: conversion error repopulation not working

2012-05-31 Thread Łukasz Lenart
2012/5/31 J. Garcia : > Ok. Sorry. > Fixed the example to match the real situation. Prepare() will only execute > now if the request is a get method. Ok, looks like a problem is with getText() in jsp but I think there is no other way ... you can use String instead and check for errors in getter/se

Re: conversion error repopulation not working

2012-05-30 Thread Łukasz Lenart
2012/5/29 J. Garcia : > Attached an example, generated from struts2 archetype and modified to > reproduce the situation. > > - run with mvn jetty:run. I use maven 2.2.1. > - on browser, type: localhost:8080/struts-test/example/Login > - you'll see a form, with formatted integer. > - modify the inte

Re: conversion error repopulation not working

2012-05-29 Thread Łukasz Lenart
2012/5/29 J. Garcia : > Integer. Strange, should work. Could you post an example code ? Regards -- Łukasz mobile +48 606 323 122 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscri

Re: conversion error repopulation not working

2012-05-29 Thread J. Garcia
Integer. On Mon, May 28, 2012 at 10:04 AM, Łukasz Lenart < lukasz.len...@googlemail.com> wrote: > Is it int either Integer ? > > > Regards > -- > Łukasz > mobile +48 606 323 122 http://www.lenart.org.pl/ > Warszawa JUG conference - Confitura http://confitura.pl/ >

Re: conversion error repopulation not working

2012-05-28 Thread Łukasz Lenart
Is it int either Integer ? Regards -- Łukasz mobile +48 606 323 122 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional

Re: conversion error repopulation not working

2012-05-25 Thread J. Garcia
Thanks Lukasz for your reply. While preparing a minimal example, I got the reason of it all. The real situation is: - The input form has an int field - The value already available should be formatted and localized: 43,000 / 43.000 - In order to achive l10n, the input field tag is like this:

Re: conversion error repopulation not working

2012-05-23 Thread Łukasz Lenart
Could you add some code example ? Regards -- Łukasz mobile +48 606 323 122 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For addi

conversion error repopulation not working

2012-05-23 Thread J. Garcia
Hi, In order to implement a good user experience, I am trying to put into practice the conversion validator, as documented here: http://struts.apache.org/2.3.3/docs/conversion-validator.html The ideal would be: a form with one integer field. If the user enters a non valid integer, the value rema