自引用实体
我有一个名为 person 的实体。 每个人有三个字段:
性别(男,女) 母亲(自称人) 父亲(自我引用人员)
现在,在我看来 jspx,我希望两个选定的字段仅在母亲选择中显示女性人员,在父亲字段中显示男性人员。最好的方法是什么?
I have an entity called person.
Each person has three fields :
sexe (male, female)
mother (self referenced to person)
father (self referenced to person)
Now, in my view jspx, I would like the two selected fields to only display female personn in the mother select and male personns in the father field. What would be the best way to do that ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您应该创建动态查找器来按
性别
获取人员。在 Roo 控制台中输入:然后找到类似
findPeopleBySex
的内容并输入:如果您不想搭建此查找器的脚手架,可以将
exposeFinders = false
添加到@RooWebScaffold
注释。PersonController
的然后你应该打开你的
PersonController
(我想它的主体是空的)并放置如下内容:最后打开你的
{project_root}/src/main/webapp/WEB-INF/views /people/create.jspx
然后找到以下几行:并将其更改为:
确保
z
属性(哈希码)的值变为用户管理
。这意味着Roo将来不会改变它。现在您可以运行您的应用程序并查看结果。
First of all, you should create dynamic finder to get persons by
sex
. Type in Roo console:Then find something like
findPeopleBySex
and type:If you don't want to scaffold this finder you can add
exposeFinders = false
to the@RooWebScaffold
annotation of yourPersonController
.Then you should open your
PersonController
(which body is empty I suppose) and place there something like the following:Finally open your
{project_root}/src/main/webapp/WEB-INF/views/people/create.jspx
then find the following lines:And change them to be:
Make sure the value of
z
attribute (hash code) becomeuser-managed
. It means Roo will not change it in future.Now you can run your application and see the result.