Results 1 to 5 of 5

Thread: don't changed date format('MM dd, yyyy') ?

  1. #1
    Join Date
    Jun 2008
    Location
    seoul, korea
    Posts
    6

    Lightbulb don't changed date format('MM dd, yyyy') ?

    Hi All

    i want to change data format(MM dd,yyyy -> yyyy-MM-dd).


    my Roo Version is 1.0.0.RC1 and my action is...

    1. domain field command in Roo shell
    add field date jpa -class ~.domain.Foo -fieldName regDate -type java.util.Date

    2. FooController_Roo_Controller.aj
    @org.springframework.web.bind.annotation.InitBinde r
    public void AccountController.initBinder(org.springframework.w eb.bind.WebDataBinder binder)
    {
    binder.registerCustomEditor(java.util.Date.class, new org.springframework.beans.propertyeditors.CustomDa teEditor(new java.text.SimpleDateFormat("MM dd, yyyy"), false));
    }


    3. create.jsp
    <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_regDate', widgetType : 'dijit.form.DateTextBox', widgetAttrs : {constraints: {datePattern : 'MM dd, yyyy', required : false}, datePattern : 'MM dd, yyyy'}})); </script>


    it(dateformat) is fixed. not changed. if it was hard coding, it would be roo shell rewrited



    so, my opinion is...

    1. add option shell command

    add field date jpa -class ~.domain.Foo
    -fieldName regDate -type java.util.Date
    -format yyyy-MM-dd

    2. add attribute for @RooWebScaffold

    @RooWebScaffold(
    automaticallyMaintainView = true, formBackingObject = Foo.class, initBinder.dateFormat='yyyy-MM-dd')

    thank you for read.
    sorry, So shot English
    Last edited by yunsunghan; Sep 16th, 2009 at 08:00 PM.

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Would you mind logging this suggestion into a JIRA ticket athttp://jira.springframework.org/browse/ROO and Stefan will take a look at the best way of handling date formats. There have also been some recent issues in JIRA to do with this topic:

    http://jira.springframework.org/browse/ROO-204
    http://jira.springframework.org/browse/ROO-190
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  3. #3
    Join Date
    Jun 2008
    Location
    seoul, korea
    Posts
    6

    Default postd jira(ROO-210)


  4. #4
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    I have provided a configuration option for this via the @WebScaffold annotation. Please take a look there and let me know if that helps:

    https://jira.springsource.org/browse/ROO-210

    Cheers,
    Stefan

  5. #5
    Join Date
    Jun 2008
    Location
    seoul, korea
    Posts
    6

    Smile

    I did a simple test was very well.

    entry shell command :
    new controller automatic... -dateFormat yyyy-MM-dd.

    and, generated @RooWebScaffold :
    @RooWebScaffold(path = "account", automaticallyMaintainView = true, formBackingObject = Account.class, dateFormat = "yyyy-MM-dd")

    it is tested simply full roo script.
    Code:
    // project
    create project -topLevelPackage kr.js.sms -projectName max
    configure logging -level DEBUG
    install jpa -provider HIBERNATE -database HYPERSONIC_IN_MEMORY
    
    // Account
    new persistent class jpa -name ~.domain.Account
    add field string -class ~.domain.Account -fieldName accountId -notNull -sizeMin 4 -sizeMax 20
    add field string -class ~.domain.Account -fieldName accountPw -notNull -sizeMin 4 -sizeMax 20
    add field date jpa -class ~.domain.Account -fieldName regDate -type java.util.Date
    
    // test
    new integration test -entity ~.domain.Account
    
    //controller
    new controller automatic -name ~.web.AccountController -formBackingObject ~.domain.Account -dateFormat yyyy-MM-dd
    im so happy. thanks Stefan
    Attached Images Attached Images

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •