Results 1 to 7 of 7

Thread: Questions realted to controllers and views

  1. #1
    Join Date
    May 2005
    Location
    BEEK, The Netherlands
    Posts
    230

    Default Questions realted to controllers and views

    I created a basic domain class (assume Book) with a couple of String properties and created a new automatic controller. This worked fine and I was able to run it tomcat.

    I extended my domain model with a second class (assume Author) with also a couple String properties.
    I also added a reference from the Book class to Author and Author contained a set of Books.

    I created an automatic controller for Book and started tomcat.

    The new Author controller and views do not work correct. 2 out of 3 String properties were required. I filled in all fields but got an error saying "may not be null".
    But I filled in all fields with values a | b | c.
    Now the second strange thing is the first field contains the value "a,b,c"

    I also went back to the Book controller/views and wanted to create a book. But the author property was not available in create form. Do I have to re-generate the controller/views? Which command?


    Cheers,
    Marcel

  2. #2
    Join Date
    Jul 2009
    Posts
    12

    Default

    Did you specify a length when creating the String fields? There is a known issue with the DOJO front end when you have Text Areas( long string length) elements that will concatenate your values.

    Quick work around is to change your field length( I think anything greater than 30 gets turned into a text area) or if you need the longer text then you can manually edit the associated JSP's so that they are Input="Text". If you do this, make sure to change your @RooWebScaffold annotation in your controller class so that it no longer maintains the views , e.g.

    @RooWebScaffold(automaticallyMaintainView = false, formBackingObject = Author.class)

    Roo should have automatically updated your Book views to show the Author object/Reference. Try restarting the roo shell and see if it updates.

  3. #3
    Join Date
    May 2005
    Location
    BEEK, The Netherlands
    Posts
    230

    Default

    Is there already a JIRA created for this DOJO problem?

    I think for the final Roo (and we have RC1 currently) this really should be fixed.
    Perhaps the templates should use a textinput instead of a textarea?

    I also noticed why I found the missing author object/reference:
    <c:if test="${not empty authors}">
    ..
    was part of the generated view.


    I really hope the templates used to generate controllers/views will be customizable soon: http://jira.springframework.org/browse/ROO-168

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

    Default

    Hi Marcel,

    Yes the Dojo issues are known (ROO-143, ROO-96). In fact they turned out not to be Dojo issues bt Spring JS. Both are fixed in RC1 so you should not see these problems any more. I have just verified this and it works for me. Can you provide details (script, instructions to replicate, java version, OS, etc)?

    The other problem with the Authors and Books is a design choice. In this case you have a relationship and roo will attempt to provide a drop-down box for Books (if Authors are present). So it would be natural for you to first create a couple of authors and then create a book and assign an author to it.

    Hope this helps.

    -Stefan

  5. #5
    Join Date
    May 2005
    Location
    BEEK, The Netherlands
    Posts
    230

    Default

    Hi Stefan,

    Just found out STS is not picking up my RC1 configured Roo installation folder but instead is using the embedded M2...
    I think this is the problem.

    I will raise an issue within the STS project.

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

    Default

    Hi Marcel,

    In STS there are two ways to register a different (newer version of Roo) one is to use the project specific properties and the other is to do it via the global configuration. STS 2.1 RC1 has a known bug where the global variant does not work and I have raised this with Christian Dupuis a while ago. This has been fixed since (so if you are using a nightly snapshot of STS the issue should be resolved). No need to raise a Jira issue for it. The next release of STS should contain the fix.

    Regards,
    Stefan

  7. #7
    Join Date
    May 2005
    Location
    BEEK, The Netherlands
    Posts
    230

    Default

    Thanks Stefan, but just raised the JIRA.
    I will put some comment in it...

    I'm not using the nightly builds so will try to change the setting at project level.

    Cheers,
    Marcel

Posting Permissions

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