Struts 中的控制器 [英] Controller in Struts

查看:21
本文介绍了Struts 中的控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MVC 中的控制器是什么?

struts.xml 还是 Servlet (Action Class)?

我们的应用程序中可以有多个 Controller 吗?

拥有多个控制器是一种好习惯吗?

解决方案

在 Struts 中,应用程序控制器层代码/功能分为两部分:

  • ActionServletRequestHandler
  • Action

ActionServlet 就像

图片来自 这篇 OnJava 文章.

What is Controller in MVC ?

Is it struts.xml or Servlet (Action Class)?

Can we have more than one Controller in our application?

Is it good practice to have more than one controller?

解决方案

In Struts, application Controller layer code/functionality is split into two parts:

  • ActionServlet with RequestHandler
  • Action classes

ActionServlet acts like FrontController pattern.

Image from this OnJava article.

这篇关于Struts 中的控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆