Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 87732 invoked from network); 11 Oct 2006 17:39:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Oct 2006 17:39:42 -0000 Received: (qmail 70532 invoked by uid 500); 11 Oct 2006 17:39:39 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 70521 invoked by uid 500); 11 Oct 2006 17:39:39 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 70510 invoked by uid 99); 11 Oct 2006 17:39:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Oct 2006 10:39:39 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of larry.meadors@gmail.com designates 64.233.184.224 as permitted sender) Received: from [64.233.184.224] (HELO wr-out-0506.google.com) (64.233.184.224) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Oct 2006 10:39:37 -0700 Received: by wr-out-0506.google.com with SMTP id 55so71530wri for ; Wed, 11 Oct 2006 10:39:17 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=Vs71O+S3Cb22VTgyEHvVbIyHT/qrf4kkEvF2V5CBuZdk0rVOzsOJDsHW5tTJNsIZZqrkC+EHGpWS8PAEMHkdWI9/ndpULXZptuAc5PBaq1i/kvzsJAvpj+7BwCTZLIVsvCfVDF6PbO+68TiXrFUB/bK9j7K4Qxd2yQPOvmcyZLs= Received: by 10.90.72.10 with SMTP id u10mr680812aga; Wed, 11 Oct 2006 10:39:17 -0700 (PDT) Received: by 10.90.87.17 with HTTP; Wed, 11 Oct 2006 10:39:17 -0700 (PDT) Message-ID: Date: Wed, 11 Oct 2006 11:39:17 -0600 From: "Larry Meadors" Reply-To: lmeadors@apache.org Sender: larry.meadors@gmail.com To: user-java@ibatis.apache.org Subject: Re: Date format conversion to/from db In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Google-Sender-Auth: 12a5caa80deeddb3 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hmm, it's been years since I used the display: tags, but I think you could use a decorator for that case - look in the docs for the display: tags for examples. Larry On 10/11/06, Ou, Stan (Mission Systems) wrote: > Thanks for your quick reply, Larry. > > In the jsp, we also use displaytag to display if it's a listing, so not > sure if the tag could fit in, but will give it a try. The > displaytag syntax is as follow: > > requestURI="/shr.gcss"> > > > > -----Original Message----- > From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On Behalf > Of Larry Meadors > Sent: Wednesday, October 11, 2006 10:25 AM > To: user-java@ibatis.apache.org > Subject: Re: Date format conversion to/from db > > Make your beans use java.util.Date. > > Use jsp tags for output. > > In your forms, pick a date format, then on the backend, do the > conversion from string to date - spring does most of that for you, IIRC. > > Larry > > > On 10/11/06, Ou, Stan (Mission Systems) wrote: > > > > > > > > Hi all, > > > > I've an application that integrates Spring and iBatis with an Oracle > > backend. We were using Oracle's bc4j before we made the switch. > > Since our dates are persisted to the db in a different format from > > what we display on the jsp, what would be the best approach to do the > > conversion? The most straightforward way I think is use a util class > > to do the conversion in the getter/setter of the pojo but I'll have to > > > make the pojo's setter smart enough to know whether I'm reading from > > the db or being bound to a form by Spring, something along this line: > > > > If reading from db for display on jsp > > convert from db to gui format > > > > If being bound to Spring form and then persisted to db > > convert from gui to db format > > > > The same goes for the getter. > > > > Our pojos are auto generated, so any logic added will get wiped out if > > > someone regenerates the pojo. > > Can anyone shed some lights on this? Any suggestions are welcomed. > Thanks. > > > > Stan >