3 层应用程序的 Java 和 J2EE 代码示例

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/685119/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 13:22:46  来源:igfitidea点击:

Java and J2EE code examples for 3-tier apps

javajakarta-ee

提问by yoitsfrancis

Do you know a site that offers a tutorial with sample source code for a 3-tier application (the usual data access layer, business layer and UI layer)?

您是否知道某个站点提供了包含 3 层应用程序(通常的数据访问层、业务层和 UI 层)的示例源代码的教程?

The simple, readable and intuitive the source code. Best practices that are applied to the code are welcome as well.

源代码简单、易读、直观。也欢迎应用于代码的最佳实践。

采纳答案by Vinzzz

Take a look at Appfuse, it's a quick-starter for java web application, provided with different frameworks : Tapestry , Spring MVC / Struts2 /JSF + Hibernate / Hibatis. It's based on a Maven build, all basic configurations done for you... One of the few 'realistic' sample that come to my mind...

看看Appfuse,它是一个 Java Web 应用程序的快速入门,提供了不同的框架:Tapestry、Spring MVC / Struts2 /JSF + Hibernate / Hibatis。它基于 Maven 构建,为您完成所有基本配置......我想到的为数不多的“现实”示例之一......

Another one is the Petstore application from sun, and looking for 'petstore download' on Google, you can find stuff that seems interesting (to me anyway, i didn't give it a look :-), like this spring petstore, "an Ajax based application with DWR, Spring and Hibernate"...

另一个是来自 sun 的 Petstore 应用程序,在谷歌上寻找“petstore 下载”,你可以找到看起来很有趣的东西(反正对我来说,我没有看:-),比如这个spring petstore,“一个带有 DWR、Spring 和 Hibernate 的基于 Ajax 的应用程序”...

回答by David Rabinowitz

The sample application I'm aware of are the following:

我知道的示例应用程序如下:

  • The famous Java Pet Storefrom Sun. In the version I've downloaded, it used a wide range of Java EE technologies, but it didn't use any modern MVC framework.
  • From the Spring project you have several applications: JPetStore, Pet Clinic and more. All come with the spring download.
  • The Seam framework has an Hotel Booking application
  • You can also have a look at the 3 tier open source applications such as Liferay, but bare in mind that they may by very large. I'm not familiar with any that I can recommend, so please google for CRM/ERP/Protals etc. (sourceforge and freshmeat.net might be good sources as well)
  • Although it is backed by a CMS and not database, Artifactorymay also serve as a good example.
  • Sun著名的Java Pet Store。在我下载的版本中,它使用了广泛的 Java EE 技术,但没有使用任何现代 MVC 框架。
  • 在 Spring 项目中,您有几个应用程序:JPetStore、Pet Clinic 等等。所有这些都带有 spring 下载。
  • Seam 框架有一个Hotel Booking 应用程序
  • 您还可以查看 3 层开源应用程序,例如Liferay,但请记住,它们可能非常大。我不熟悉我可以推荐的任何内容,所以请谷歌搜索 CRM/ERP/Protals 等(sourceforge 和 freshmeat.net 也可能是很好的来源)
  • 尽管它由 CMS 而不是数据库支持,Artifactory也可以作为一个很好的例子。

Hope these help.

希望这些有帮助。

回答by duffymo

Yes, have a look at the Spring MVC step by stepexample. It's very clear.

是的,看一下Spring MVC 的分步示例。这很清楚。