重用其他实体的视图
我的 Spring Roo 应用程序中有 2 个实体:Experiment
和 Story
。 实验
可以包含多个故事。我已经构建了一个用于显示故事的视图。
我可以直接重用该视图来渲染实验视图中包含的故事吗?如果是,该怎么做?
I have 2 entities in my Spring Roo application, Experiment
and Story
. Experiment
can contain several stories. I have already build a view for displaying a story.
Can I directly reuse that view to render the stories that are contained in an experiment's view? If yes, how to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大胆尝试,但我想说,您可以使用 JSP 标记来执行某些操作,这些标记查看某些值、检查类类型,并在显示一个故事或一系列故事之间进行切换。
或者,您可以使您的 Model 值始终为列表,然后让您的视图 JSP 始终循环该列表,因此,如果它获得 1 的列表,则显示 1,10 的列表将显示 10 或者,
您可以创建自定义 Dojo Widget。拥有单独的视图(或执行上述操作)并简单地使用自定义小部件来显示单个故事。循环浏览列表,添加其他小部件,您会看到多个小部件。
Taking a shot-in-the-dark, but I would say you could do something using JSP tags that look at some value, check the class type, and switch between displaying one Story or a list of Stories.
Or, instead of that, you could make your Model value always be a List, and then just make your view JSP always loop the list, so if it gets a list of 1, it shows 1, a list of 10 would show the 10.
Or, you could create a custom Dojo Widget. Have separate view (or do the above) and simply use the custom widget to display a single Story. Loop through the list, adding additional Widgets, you get a display of more than one.