Java - 学习 MVC

发布于 2024-12-23 13:43:12 字数 1536 浏览 3 评论 0原文

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

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

发布评论

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

评论(5

骷髅 2024-12-30 13:43:12

这是一个非常好的示例 http://www.leepoint.net/GUI/struct/40mvc。 html 我试图找到最简单的可能让你感受到这个想法。

无论如何,我不喜欢:

在我看来,Java 中没有定义的 MVC 架构。

您可以在各种不同的语言中使用 MVC、MVP 和整个其他模式。 Java 与 MVC 无关,只是 MVC 设计可以用 Java 编写。然而,有些框架嵌入了 MVC 架构并强制使用它。 Spring MVC 是最著名的 - 尝试找到更多关于它的信息,也许是一些教程。

Here is pretty nice example http://www.leepoint.net/GUI/structure/40mvc.html I tried to find simplest possible to let you feel the idea.

Anyway I don't like the:

Seems to me there is not a defined MVC architecture in Java.

You can use MVC, MVP and whole other patterns in various different languages. Java has nothing to do with MVC, except MVC design can be coded in Java. There are, however, some frameworks that have embedded MVC architecture and forces using it. Spring MVC is the most known - try to find more about it, maybe some tutorials.

年华零落成诗 2024-12-30 13:43:12

模型 - 模型表示携带数据的对象或 JAVA POJO。如果数据发生变化,它还可以具有更新控制器的逻辑。

视图 - 视图表示模型包含的数据的可视化。

控制器 - 控制器作用于模型和视图。它控制进入模型对象的数据流,并在数据发生变化时更新视图。它将视图和模型分开。

mvc简单示例

Model - Model represents an object or JAVA POJO carrying data. It can also have logic to update controller if its data changes.

View - View represents the visualization of the data that model contains.

Controller - Controller acts on both Model and view. It controls the data flow into model object and updates the view whenever data changes. It keeps View and Model separate.

mvc simple example

一抹微笑 2024-12-30 13:43:12

请参阅此示例mvc简单示例,它将两个数字相加使用swings进行编程。通过这个例子你可以很容易地理解mvc的概念

see this example mvc simple example which is adding two numbers program using swings.by this example you can easily understud the concept of mvc

独守阴晴ぅ圆缺 2024-12-30 13:43:12

看一下 spring 框架,您也可以将它与 swing 一起使用,如 教程。

Take a look at the spring framework, you can use it also with swing as shown in this tutorial .

月依秋水 2024-12-30 13:43:12

下面的教程使用所谓的 ObserverObservable 类的 Java 内置功能,通过示例解释了 MVC 的概念。

带有观察者和可观察类的 MVC 示例

Using Javas in-built capabilities of the so called Observer and Observable classes the following tutorial explains the concept of MVC by an example.

MVC by Example with observer and observeable classes

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