quick and dirty solution: i know that this works if you use hibernate with annotations so i'm certain that there is a possibility to do it with xml. With annotations you can declare whether the data is extracted directly from the property or indirectly over the getter-method of the property. Make hibernate get the value directly from the property which uses the mm/dd/yy format. Define the getter-method and setter-to format in and out of dd/mm/yy. Because Struts 2 always uses the getter-setter you alway have the right format.
class DomainModelObject { //format = mm/dd/yy private String date; public String getDate() { formatToDDMMYY( date ); } public void setDate( String ddmmyyDate ) { date = formatToMMDDYY( ddmmyyDate ); } } cleaner solution: I'm certain there is a better way to do this because the i18n-part of Struts 2 allows you to format the date differently depending on the locale of the date. Therefore you should save the date in the format hibernate wants and use DateFormat to format the Date for the view layer. Maybe you find something here: http://struts.apache.org/2.0.11.2/docs/formatting-dates-and-numbers.html /Stephan -------- Original-Nachricht -------- > Datum: Fri, 22 Aug 2008 03:31:30 -0700 (PDT) > Von: Hardik Shah <[EMAIL PROTECTED]> > An: user@struts.apache.org > Betreff: struts-hibernate-mysql date problem > > hi > i am using hibernate 3 with s2 my problem is that > > im mysql table i have field of date type > > so i have set type date in hb mapping.xml and in pojo(if i am set as > string > in pojo and mapping file it gives error ) > > now i have to set date in input as format mm/dd/yy so mysql accepts it > automatically and convert in its foramt type(YY-dd-mm) otherwise it > return > to input result > > but i want to show it as dd/mm/yy ,what i have to do for this any > convertor > of s2 apply or what? > > please help to solve this problem > > > ----- > > > Java/J2EE developer > India > > blogs > http://hardik4u.wordpress.com wordpress blog > > -- > View this message in context: > http://www.nabble.com/struts-hibernate-mysql-date-problem-tp19104863p19104863.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]