Spring Roo 演示和模型绑定
我开始使用 Spring Roo 来使用 Springsource。
第一季度。我说 Spring Roo 自动化了 Spring 中的许多单调乏味的工作,这样说对吗?
我这么问是因为当我遵循 Spring 上的非 roo 教程时,我读到我必须执行大量的配置和存根,而这些配置和存根本来是由 roo 完成的。我不明白为什么在 roo 之前 Spring 会帮助减少我的工作量。
第二季度。是否有必要使用命名空间 ~.domain.whatever 来定义实体。必须要有“域名”吗?我可以做吗
entity --class ~.profile.PostalAddress
? Spring对“域”这个词敏感吗?
第三季度。我想定义一个实体,
Employee { long id, string name, string project, date startdate}
我想将 Employee 绑定到演示面板,其中
- id 是隐藏字段,
- 名称显示不可编辑字段,
- 项目显示可编辑字段,填充数据库中的当前值,
- startdate 甚至不是发送到浏览器。
我如何在 Roo 中实现这一目标?如果我不能在 Roo 中做到这一点,有没有一种方法可以让我用 Spring 生成的内部结构来完成它,它有多容易?
第四季度。 Spring roo 生成一个标准模板 Web 界面。但我不想使用该界面。我只是想让 roo 为我生成 RESTful 面板,我可以将其与 GWT 菜单项关联起来。
原因是我需要使用 GWT/SmartGWT 导航小部件,并且当通过 gwt/smartgwt 调用适当的数据操作项时,我想以 REST方式调用/启用 Spring 生成的数据面板。
如何让 roo 或随后的 Spring 为我的每个实体生成 RESTful 数据面板,而不使用 Spring 或 roo 生成的(无用/无吸引力的)默认导航侧窗格?我需要手动修改那些 roo 生成的文件吗?如果是这样,如何以及什么?
简而言之,我想利用 roo 的帮助来生成大量演示验证模型绑定模块,但使用我自己的 GWT/Smart GWT 来导航到它们。我不是在问 roo+gwt。
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 get 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Q1:确实,在 Roo 之前,您必须为 Spring 应用程序编写相当多的配置文件。然而,如果没有 Spring,您将不得不编写更多的配置,更糟糕的是,还需要编写 Java 代码来将它们粘合在一起。
Q2: Roo 对“域”这个词不了解。您可以以任何您想要的方式调用您的包。就我个人而言,我更喜欢域类的子包“模型”。
抱歉,无法透露有关 Q3 和 Q4 的任何内容。
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.
警告 - 我不是原产地规则专家..我自己刚刚开始
问题 3:
您可以在此处了解如何完成所有这些操作:
http://static.springsource.org/spring -roo/reference/html/base-web.html#jsp-views
ID :您需要导入标准 jstl 标签以支持
(Roo 默认情况下没有此功能)..名称:您可以将名称字段呈现为纯文本,或禁用文本框 - 如果是后者,您可以添加我相信标签的disabled = true。
Project :Roo 会开箱即用地执行 Project 所需的操作(不过,如果“Project”是多对多关系中的另一个实体,它会默认创建一个选择框,其中包含所有可能的项目,以及当前选择的项目)
StartDate :在 roo 生成的标记上设置“render='false'”,它甚至不会输出该字段的 html。
在所有情况下,Roo 都会重写您的输入字段,除非您将标签 Z 字段更改为
z="user-management"
。我可能会保留原始的 ROO 标签,将其更改为
render="false" z="user-management"
并在其下方添加您自己的标签以执行您真正想要的操作。Q4
不熟悉 GWT,但您考虑过
roo web gwt
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