reading the docs I discovered the possibility to override default
typeconverters (cf:
http://struts.apache.org/2.3.4/xwork-core/apidocs/com/opensymphony/xwork2/conversion/impl/XWorkBasicConverter.html
)

== Quote from the docs
As from version 2.3.2 you can override default converters by
implementting TypeConverter interface and specifying beans in
struts.xml as follow: <bean
type="com.opensymphony.xwork2.conversion.TypeConverter"
name="collection" class="com.application.MyCollectionConverter"
scope="singleton"/>

I tried with that approach by creating a new TypeConverter (roughly
copied from com.opensymphony.xwork2.conversion.impl.NumberConverter)
adding the following line in struts.xml right after the <struts> tag
<bean type="com.opensymphony.xwork2.conversion.TypeConverter"
name="number" class="com.company.app.NumberConverter"
scope="singleton"/>

but the webapp failed to start with the following error.

Caused by: Bean type interface
com.opensymphony.xwork2.conversion.TypeConverter with the name number
has already been loaded by [unknown location] - bean -
file:/D:/dev/tomcat/webapps/blank/WEB-INF/classes/struts.xml:10:132
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:227)

Am I missing something ?

Pierre.

On Tue, Jun 19, 2012 at 9:18 PM, Dave Newton <davelnew...@gmail.com> wrote:
> On Tue, Jun 19, 2012 at 1:02 PM, Chris Pratt <thechrispr...@gmail.com>wrote:
>
>> If you want to handle parsing yourself, make your action properties take
>> "String" parameters and do the parsing in the action.
>>
>
> Probably better to do  your own type converter, though, particularly if
> it's app-wide.
>
> Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to