XWork, Ognl, and type conversion.
Today I spent some time on seeing if Ognl would be a good choice for bean manipulation in XWork. Well, things were running well until I hit two very large snags
1) Performance is the pits. I mean, Ognl is literally 25X slower than WebWork's BeanUtil method.
2) Ognl, like BeanUtil, OSCore BeanUtils, and Jakarta Commons-BeanUtils, has no way to get data in a type-specific way. This is actually more important than people tend to think. Sure, converting from input is important (setValue in all the above implementations has a way to convert data), but getting the data back in the same way we set it is equally important. Example:
User inputs a date as "02/12/1982". This should be calling FooAction.setBar(Date). FooAction also has a method "Date getBar()". But when we display the data back to the user, we want to display it as "02/12/1982" or "12/02/1982" or however the user first entered it. This means that type conversion needs to happen both ways, not just for setting values. So I think I'll write my own code that does this and is tuned specifically for XWork (Ognl has too much other stuff going on, which is probably why it's so much slower).
[PSquad's Corner]
However it sounds like what you really want to do is to use internationalization to convert the value into a localised String representation? If its any help, there's various JSP custom tags in JSTL for doing this kinda thing.