Announcement Announcement Module
Collapse
No announcement yet.
don't changed date format('MM dd, yyyy') ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 09:00 PM.

  • #2
    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

    Comment


    • #3
      postd jira(ROO-210)

      thanks Alex

      http://jira.springframework.org/browse/ROO-210

      Comment


      • #4
        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

        Comment


        • #5
          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

          Comment

          Working...
          X