Hi Daniel,

Maybe this will help.
You may create converters for any type.
Here is one I use for dates.
You also need to put 'xwork-conversion.properties' file in classpath,
something like:

java.util.Date=aaa.utils.typeconverter.DateConverter

And the converter class:

public class DateConverter extends DefaultTypeConverter {
        public static final String DATE_FORMAT = "yyyy-MM-dd";
        
        @Override
        public Object convertValue(Map ctx, Object o, Class toType) {
                if (toType == Date.class) {
                        String val = ((String[]) o)[0];
                        if (val != null && val.length() > 0) {
                                SimpleDateFormat sdf = new 
SimpleDateFormat(DATE_FORMAT);
                                try {
                                        return sdf.parse(val);
                                } catch (Exception e) {
                                        System.out.println("Problem z konwersja daty: " + 
val + ", " +
e.getMessage());
                                }
                        }
                } else if (toType == String.class) {
                        return o.toString();
                }
                return null;            
        }
}

Regards
Dariusz Wojtas

On 2/24/07, Daniel Amadei <[EMAIL PROTECTED]> wrote:
Hi All,

I'm working with dates but I'm not able to convert dates to be
displayed automatically using the brazilian format (e. g. dd/MM/yyyy).
Also I'd like to know how to validate my dates using this format and
not the standard.

If somebody could point me to the docs where I can find some info
about those 2 items it would be great!

BTW: I`m not using the datetimepicker.

Thanks,
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to