Spring Roo Presentation and Model binding
I am starting on Springsource using Spring Roo.
Q1. Am I correct to say that Spring Roo automates a lot of tedium out of Spring?
I am asking that because when I follow non-roo tutorials on Spring, I am reading that I have to perform a significant amount of configuration and stubs which would have been done by roo. I don't see why, prior to roo, would Spring help reduce my work load.
Q2. Is it necessary to define entities using the namespace ~.domain.whatever. Is it necessary to have "domain"? Can I do
entity --class ~.profile.PostalAddress
? Is Spring sensitive to the word "domain"?
Q3. I would like to define an entity
Employee { long id, string name, string project, date startdate}
I would like to bind Employee to a presentation panel where
- id is a hidden field,
- name is displayed non-editable field,
- project is displayed editable field populated with the current value in the db,
- startdate is not even sent to the browser.
How do I accomplish that in Roo? If I cannot do that in Roo, is there a way I could muck around with the Spring generated innards to accomplish it and how easy would it be?
Q4. Spring roo generates a standard template web interface. But I do not wish to use the interface. I just want roo to generate RESTful panels for me, which I could associate with a GWT menu item.
The reason is I need to use GWT/SmartGWT navigation widgets and when the appropriate data manipulation item is called thro gwt/smartgwt, I would like to call/enable that Spring generated data panel RESTfully.
How do I ge开发者_如何转开发t roo, or subsequently Spring, to generate a RESTful data panel for each of my entity without using Spring or roo's generated (useless/unattractive) default navigation side panes? Would I have to manually modify those roo generated files? If so, how and what?
In short, I want to use the convenience of roo's help in generating lots of presentation-validation-model bound modules but use my own GWT/Smart GWT to navigate to them. I am NOT asking about roo+gwt.
Q1: It is true that prior to Roo you would have to write quite a few configuration files for a Spring application. However, without Spring you would have to write even more configuration and, worse, Java code to glue it all together.
Q2: Roo is agnostic of the word "domain". You can call your packages any way you want. Personally I prefer the sub-package "model" for domain classes.
Can't say anything about Q3 and Q4, sorry.
Caveat - I am not a ROO expert.. just getting started myself
Q3:
You can find out how to do all of that here : http://static.springsource.org/spring-roo/reference/html/base-web.html#jsp-views
ID : you'll need to import the standard jstl tags to support <frm:hidden>
(Roo doesn't have this by default)..
Name: You can render the Name field as plain text, or as a disabled text box -- if the latter, you can add disabled=true to the tag, I believe.
Project : Roo will do what you need for Project out of the box (although, if "Project" is another entity in a Many-Many relationship, it will create a Select Box by default, with all the possible Projects, and the current one selected)
StartDate : set "render='false'" on the roo-generated tag and it will not even output the html for that field.
In all cases, Roo will re-write your input fields unless you change the tags Z field to z="user-managed"
.
I would probably keep the original ROO tag, change it to render="false" z="user-managed"
and add your own beneath it to do what you really want.
Q4
Not familiar with GWT, but have you considered the roo web gwt
精彩评论