Announcement Announcement Module
Collapse
No announcement yet.
Addon web-mvc-controller Scaffold command (Roo-1.0.0.RC4) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Addon web-mvc-controller Scaffold command (Roo-1.0.0.RC4)

    Hi,

    For see same result type below lines in the Roo console :
    Code:
    entity --class ~.domain.FooBar
    field date --fieldName today --type java.util.Date --class ~.domain.FooBar
    controller scaffold --class ~.web.FooBarController
    Two things about generated code :

    create.jspx
    Code:
                <div id="roo_foobar_today">
                    <label for="_today_id">Today:</label>
                    <form:input cssStyle="width:250px" id="_today_id" maxlength="30" path="today" size="0"/>
                    <br/>
                    <form:errors cssClass="errors" id="_today_error_id" path="today"/>
                    <spring:message arguments="Today" code="field.invalid" var="field_invalid"/>
                    <spring:message code="field.required" var="field_required"/>
                    <spring:message argumentSeparator="," arguments="Today," code="field.simple.validation" var="field_validation"/>
                    <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_today_id', widgetType : 'dijit.form.ValidationTextBox', widgetAttrs : {promptMessage: '${field_validation}', invalidMessage: '${field_invalid}', required : false}})); </script>
                    <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_today_id', widgetType : 'dijit.form.DateTextBox', widgetAttrs : {promptMessage: '${field_validation}', constraints: {datePattern : '${foobar_today_date_format}', required : false}, datePattern : '${foobar_today_date_format}'}})); </script>
                </div>
    First if we remove the scripts and submit the form with invalid date pattern then you will see below exceptions :
    Code:
    java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'foobar' available as request attribute
    	at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:141)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:175)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:195)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:161)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:124)
    	at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:409)
    	at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:140)
    	at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:91)
    	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:78)
    ...
    IO Error executing tag: JSPException including path '/WEB-INF/views/foobar/create.jspx'.
    org.apache.tiles.util.TilesIOException: JSPException including path '/WEB-INF/views/foobar/create.jspx'.
    	at org.apache.tiles.servlet.context.ServletUtil.wrapServletException(ServletUtil.java:232)
    	at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:105)
    	at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
    	at org.apache.tiles.renderer.impl.UntypedAttributeRenderer.write(UntypedAttributeRenderer.java:61)
    	at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:103)
    	at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:669)
    	at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:337)
    	at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:234)
    	at org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:211)
    	at org.apache.tiles.jsp.taglib.RenderTag.doEndTag(RenderTag.java:220)
    ....
    for fix this I need to change below parts :
    create.jspx
    Code:
            <form:form action="${form_url}" method="POST" modelAttribute="fooBar">
    FooBarController_Roo_Controller.aj
    Code:
        @RequestMapping(value = "/foobar/form", method = RequestMethod.GET)    
        public String FooBarController.createForm(ModelMap modelMap) {    
            modelMap.addAttribute("fooBar", new FooBar());        
            modelMap.addAttribute("foobar_today_date_format", org.joda.time.format.DateTimeFormat.patternForStyle("S-", org.springframework.context.i18n.LocaleContextHolder.getLocale()));        
            return "foobar/create";        
        }
    Second thing is not much important : I found out below script code would act same as two lines scripts code for date fields :
    Code:
    <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_today_id', widgetType : 'dijit.form.DateTextBox', widgetAttrs : {promptMessage: '${field_validation}', invalidMessage: '${field_invalid}', required : false, datePattern : '${foobar_today_date_format}'}})); </script>
    My current issue is I have to set automaticallyMaintainView to the false in FooBarController !

    Cheers,
    Sid
    ps. Roo is awesome :-)

  • #2
    Hi Sid,

    Thanks for raising this.

    The first problem seems to be a regression issue from a recent change. Can you open a bug ticket for this please (http://jira.springframework.org/browse/ROO)?

    The suggestion you made about merging the ValidationText box with DateText box could be raised as an enhancement request so we can keep track of it.

    Cheers,
    Stefan

    Comment


    • #3
      Jira tickets added

      Hi Stefan,
      Jira tickets added:
      http://jira.springframework.org/browse/ROO-476
      http://jira.springframework.org/browse/ROO-477

      Cheers,
      Sid

      Comment

      Working...
      X