重用其他实体的视图

发布于 2024-12-23 16:22:31 字数 165 浏览 3 评论 0原文

我的 Spring Roo 应用程序中有 2 个实体:ExperimentStory实验可以包含多个故事。我已经构建了一个用于显示故事的视图。

我可以直接重用该视图来渲染实验视图中包含的故事吗?如果是,该怎么做?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

另类 2024-12-30 16:22:31

大胆尝试,但我想说,您可以使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文