Have you looked at the examples?
Like webwork.action.test.bank.AmountEditor class. --- Chris Miller <[EMAIL PROTECTED]> wrote: > Hi, > > I want to be able to submit integer values from a form, URL parameters, etc > to my action handler, and have WebWork automatically set a property that is > of type java.lang.Integer. For example, I want to be able to do this: > > http://localhost/editProduct.action?id=100 > > I want WebWork to then call the MyAction.setId(Integer id); setter method to > store the value. Of course, if the URL was: > > http://localhost/editProduct.action?id=ABC > > I'd expect WebWork to throw an IllegalArgumentException. However I have been > unable to get this to work. *Should* this work? I've stepped through the WW > code and found where things appear to go wrong (BeanUtil.setValue() calls > BeanUtil.setStringValueDirectly(), which fails). It appears that there is no > code to handle the type conversion, hence the problem. > > I've looked in to property editors, but can't see how they help with this. > The other alternatives I can see are to implement ParameterAware, or just > accept the ID as a string, and then perform the conversion myself. However > for various reasons I'd much prefer to avoid that if possible. In many cases > I'd also prefer to avoid using a primitive such as int (since there are > cases where I want to store null's in a database). > > So... My (uncertain) conclusion is that work needs to be done in > BeanUtil.java to handle this (and other conversions such as Long, Double, > Float, Boolean etc). If someone out there wants to reassure me that this is > indeed the case, then I'm willing to figure out what's required and make the > changes (I understand that this won't make it in to v1.0). Of course, if I'm > missing something here (and I get the feeling I must be), can someone please > put me out of my misery? :-) > > Cheers, > Chris > > _______________________________________________ > Webwork-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/webwork-user ===== Cuong Q. Tran <[EMAIL PROTECTED]> __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com _______________________________________________ Webwork-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webwork-user
