有另一个组件目录(模板和java文件)

发布于 2024-10-10 19:16:56 字数 122 浏览 2 评论 0原文

我有一个关于 Tapestry 组件编程的问题。我们可以用另一个 Component 文件夹来代替原来的文件夹吗?

如果您的回答是肯定的,您如何声明它(在 AppModule 文件中...)?

谢谢

I have a question about Tapestry Component Programming. Can we have an another Component folder instead of the original one ?

If your reply is yes, How can you declare it (in the AppModule file ...) ?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

傲娇萝莉攻 2024-10-17 19:16:56

您可以创建组件包的子包:.components.menu,然后使用 或 ,例如。拥有多个根组件包是一种我真的看不出它有什么好处的东西。如果您确实想这样做,您可以在应用程序中声明一个新的组件库。 这里是文档

You can create subpackages of the components package: .components.menu and then use or , for example. Having more than one root components package is something which I really can't see a good use for it. If you really want to do that, you can declare a new component library inside your application. Here's the documentation.

微凉 2024-10-17 19:16:56

您可以实现并贡献自己的 ComponentTemplateLocator

阅读此内容

you can implement and contribute your own ComponentTemplateLocator

read this

俏︾媚 2024-10-17 19:16:56

如果您需要这种级别的分离并且无法通过子包获得它,那么您最好创建一个单独的组件库作为单独的项目。这将为您带来一些优势:

  1. 可单独测试 - 您可以在不需要成为主应用程序一部分的组件上运行测试。
  2. 可重用 - 您可以在多个项目中使用组件库,而无需剪切和粘贴。
  3. 可共享 - Tapestry 现有的许多组件库都是在人们需要解决他们正在创建的应用程序中的问题时开始的,但以通用方式这样做,以便他们可以再次使用它并可以与其他人共享它。在某些情况下,您可以以某种方式开源组件,让其他人为每个人的利益做出贡献。

也就是说,如果您绝对需要将组件放在不同的包中,请参阅 pstanton 的答案。

If you need this level of separation and you can't get it with subpackages, you may be better of creating a separate component library as a separate project. This would give you a few advantages:

  1. Separately testable - you can have test that run on your components that don't need to be part of the main application.
  2. Reusable - you can use the component library in multiple projects without needing to cut and paste.
  3. Shareable - Many of the component libraries that are out there right now for Tapestry started when on person needed to solve a problem in the app they were creating, but did so in a generic way so they could use it again and could share it with others. In some cases you may be able to open source the components in a way that will let others contribute to them for everyone's benefit.

That said, if you absolutely need to have components in a different package, see pstanton's answer.

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