You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Donato Pirozzi <do...@gmail.com> on 2009/12/16 14:23:43 UTC
xwork-conversion.properties
Hi,
I have problem with my custom converter...
I have a bean that provided get/set methods for date.
public class Person {
...
private Date bornDate;
...
public void setBornDate(Date bornDate) { ... }
public Date getBorn() { ... }
}
On my jsp I have dojo input dijit.form.DateTextBox
<s:form ...>
...
<input type="text" name="model.bornDate" dojoType="dijit.form.DateTextBox"
required="true" />
...
</s:form>
Problem is that when user submit form, there is an exception
NoSuchMethodException setBornDate(String str)
I have created my converter DateConverter that extends StrytsTypeConverter
and I have added src/main/resources/xwrork-conversation.properties (maven2
project) with mapping.
java.util.Date = org.converter.DateConverter
I don't understand if xwork-conversation.properties is loaded correctly,
because I haven't any usefully log information.
I'm using struts 2.1.8.1.
Thanks all.
Re: xwork-conversion.properties
Posted by Donato Pirozzi <do...@gmail.com>.
Hi and thanks for answer,
I have tried to use annotation, but don't work, error message is the same:
Error setting expression 'model.dataMandato' with value
'[Ljava.lang.String;@2d2da4'
ognl.MethodFailedException: Method "setDataMandato" failed for object
org.storage.mandati.Mandato@18bff68 [java.lang.NoSuchMethodException:
org.storage.mandati.Mandato.setDataMandato([Ljava.lang.String;)]
My bean have:
public Date getDataMandato() { return dataMandato; }
@TypeConversion(converter="org.common.struts2.dataconverter.DateConverter")
public void setDataMandato(Date dataMandato) { this.dataMandato =
dataMandato; }
Note: Bean is into a jar, into a package org.storage.mandati
converter is into
src/main/java/org.common.struts2.dataconverter.DateConverter
I have try it with different bean that I have into my project.
Thanks.
Lukasz Lenart wrote:
> 2009/12/16 Donato Pirozzi <do...@gmail.com>:
> Did you try to use annotations?
>
> @TypeConversion(converter = "org.demo.DateConverter")
> public void setDateNow(Date now) { this.now = now; }
>
>
> Regards
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: xwork-conversion.properties
Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/12/16 Donato Pirozzi <do...@gmail.com>:
> obviously is a typos, name of my file into my project is
> xwork-conversion.propertis
Did you try to use annotations?
@TypeConversion(converter = "org.demo.DateConverter")
public void setDateNow(Date now) { this.now = now; }
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: xwork-conversion.properties
Posted by Donato Pirozzi <do...@gmail.com>.
Thanks for the answer Lukasz,
obviously is a typos, name of my file into my project is
xwork-conversion.propertis
Sorry for the mistake.
2009/12/16 Lukasz Lenart <lu...@googlemail.com>
> 2009/12/16 Donato Pirozzi <do...@gmail.com>:
> > and I have added src/main/resources/xwrork-conversation.properties
> (maven2
>
> Should be >>xwork-conversion.properties<<
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: xwork-conversion.properties
Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/12/16 Donato Pirozzi <do...@gmail.com>:
> and I have added src/main/resources/xwrork-conversation.properties (maven2
Should be >>xwork-conversion.properties<<
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org