Struts requestprocessor、Action 类和 Form Bean 类在 MVC 中适合什么位置?

发布于 2024-12-04 02:23:31 字数 316 浏览 0 评论 0原文

这个问题是关于struts 1.2的。众所周知,struts 遵循 mvc 架构。如果我们在struts中定义mvc类,那么jsp就是视图,控制器就是actionservlet,模型就是数据存储,以及操作数据存储中数据的类,如dao类、业务逻辑类和值对象。 对吗?

我的问题是我们可以在 mvc 中的哪里放置 requestprocessor 类、action 类(如 baseaction、dispatc 操作和 Form Bean 类)。我的意思是它们被视为控制器或模型的一部分?

其次是哪个类充当struts中的requestdisptcher。

This question is regarding struts 1.2. As we know struts follows the mvc archtecture. If we define the mvc classes in struts then jsp is view,controller is actionservlet and model is datastore and classes manipulating the data in datastore like dao class, Businees logic class and value objects. Right?

My question is where we can fit requestprocessor class ,action class like baseaction,dispatc action and Form Bean class in mvc. I mean they are considered as part of controller or model?

Second is Which class act as requestdisptcher in struts.

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

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

发布评论

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

评论(1

只为一人 2024-12-11 02:23:31

Struts 1.2 文档对此进行了介绍:

http://struts.apache。 org/1.2.9/userGuide/introduction.html#mvc

http://struts.apache.org/1.2.9/userGuide/building_model.html

该模型不仅仅是数据存储,它还包括ActionForm,以及两者之间的映射。

ActionServletRequestProcessorActionMapping 一起实现控制器:ActionServlet > 将操作查找委托给 RequestProcessor,因此不能说它本身就是控制器。

请注意,各个组件之间的定义/差异可能并不总是精确地映射到各个组件。 Struts 1 在 MVC 的原始思想(转化为 Web 应用程序)与当时可用的技术之间提供了某种近似的映射。

This is covered in the Struts 1.2 documentation:

http://struts.apache.org/1.2.9/userGuide/introduction.html#mvc

http://struts.apache.org/1.2.9/userGuide/building_model.html

The model isn't just the datastore, it includes the ActionForm, and the mapping between the two.

The ActionServlet works with the RequestProcessor and ActionMappings to implement the controller: the ActionServlet delegates action lookup to the RequestProcessor so cannot be said to be the controller in itself.

Note that the definitions/differences between the various components may not always map precisely to individual components. Struts 1 provides a somewhat-close mapping between the original ideas of MVC, translated into web applications, and the technologies available at the time.

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