Hibernate Struts 项目的项目结构?

发布于 2024-09-15 03:19:14 字数 111 浏览 3 评论 0原文

我开始开发一个基于 Hibernate 和 Struts 的博客网站。我想知道如何维护目录和文件的结构。即表示层、hibernate DB 访问层、控制器和业务层。有什么建议吗?

问候 斯瓦尔

I started developing one Blog Website based on Hibernate and Struts. I was wondering how to maintain the structure of the directory and files. That is, the presentation, hibernate DB access layers, controllers and business layers. Any suggestion?

Regards
Swar

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

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

发布评论

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

评论(1

你的呼吸 2024-09-22 03:19:14

我认为这个问题没有单一的答案,但这是我的。

对于没有很强的模块化要求的简单项目,我会使用单个项目。

对于项目布局本身,我遵循 Maven 标准目录布局。对于 Web 应用程序,这通常意味着这样的内容:

.
└── src
    ├── main
    │   ├── java            - Application/Library sources
    │   ├── resources       - Application/Library resources
    │   └── webapp          - Web application sources
    │       └── WEB-INF
    └── test
        ├── java            - Test sources
        └── resources       - Test resources

我将使用 Java 打包命名约定来组织各个层中的类:

  • com.acme...web.action 对于 struts 操作
  • com.acme...web.forms :对于 struts 表单 bean
  • com.acme..。 service :用于业务服务接口和实现
  • com.acme...bo :用于业务对象
  • com.acme...dao :用于 DAO 接口
  • com.acme...dao.hib :用于 DAO 的 Hibernate 实现,

但对于小型应用程序中,我会跳过功能 细分。

相关问题

I don't think there is a single answer to this question but here is mine.

For a simple project without strong modularity requirements, I would use a single project.

For the project layout itself, I follow the Maven standard directory layout. For a webapp, this typically means something like this:

.
└── src
    ├── main
    │   ├── java            - Application/Library sources
    │   ├── resources       - Application/Library resources
    │   └── webapp          - Web application sources
    │       └── WEB-INF
    └── test
        ├── java            - Test sources
        └── resources       - Test resources

And I would use java packaging naming conventions to organize classes from the various layers:

  • com.acme.<app>.<module>.web.action for struts actions
  • com.acme.<app>.<module>.web.forms : for struts form beans
  • com.acme.<app>.<module>.service : for business services interfaces and implementations
  • com.acme.<app>.<module>.bo : for the business objects
  • com.acme.<app>.<module>.dao : for DAO interfaces
  • com.acme.<app>.<module>.dao.hib : for Hibernate implementations of the DAOs

But for a small application, I would just skip the functional <module> subdivision.

Related questions

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