ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brandon Goodin <brandon.goo...@gmail.com>
Subject Re: re: struts vs ibatis - Integer type
Date Mon, 09 May 2005 12:59:18 GMT
These links will help you write and register a converter for BeanUtils.

http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/ConvertUtilsBean.html
http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/ConvertUtils.html
http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/Converter.html

You can register the converter in a couple of places:
1) Write a servlet listener class and declare it in your web.xml
2) Write a struts plugin class and declare it in your struts-config.xml

Brandon

On 5/9/05, Darek Dober <dooverone@op.pl> wrote:
> 
> 
> >It sounds to me like you are corrupting your model and introducing
> >ambiguity. Using Strings for Dates and Integers is a bad idea. We've
> >successfully dealt with those issues without corrupting our model.
> >That is the purpose of the ActionForm. It is a point in which you need
> >to convert your user input to your model. I think you are shortcutting
> >here and will regret it later on. This is not a good practice.
> 
> More I think about that, more I relise that, you have absolutely right about
> that.
> 
> I also realise that, it goes a little beyond that group, and comes to the
> struts, but you went through it,
> 
> > > > >nested bean. The other option is to write a different BeanUtils
> > > > >Converter implementation for numerics and register it
> > > >
> > >
> >(http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanuti
> ls/ConvertUtils.html#register(org.apache.commons.beanutils.Converter,%20java
> .lang.Class).
> 
> I found strutslive application, which shows something about this, but the
> example is more sophisticated, that I need now.
> 
> The question is: What level should I  register my Converter at?
> I looked into struts source, and I went to that: the request processor
> invokes method: populate which invokes RequestUtils.convert or populate,
> which
> goes to the ConvertUtils and so on
> 
> What is the simpliest way to register my converter, that it should
> correspond to all actionForms. I want to do it above population of all
> actionForms, instead of doing it in all actionForm set/get method.
> 
> What parts /objects should I implement on my own. (whole request processor,
> and how does it affect TilesRequestProcessor used by TilesPlugin)
> 
> I realise that it is more about struts, but it came out from my topic:)
> 
> Any hints would be appreciated
> 
> Best regards
> Darek
> 
> >
> >
> 
>

Mime
View raw message