struts2面试题12010年07月10日 15:14Struts1与 Struts2的区别,它们常用到哪几个类, 以及工作流程
Struts1: ActionServlet[process()], RequestProcessor[processPreprocess()], PlugIn,Action, ActionForm, ActionForward,ActionMapping ,struts-config
xmlStruts2: FilterDispatcher, ActionSupport, ServletActionContext[getResponse()],ModelDriven[getModel()],MethodFilterInterceptorstruts
xml,它是在 WebWork 基础上发展起来的
Struts 工作流程:struts1:发布 Struts Web 服务时,根据 web
xml 初始化 ActionServlet,ActionContext 等内容
在接到一个 HttpRequest 请求后,ActionServlet 根据 struts-config
xml 中的配置内容,将请求的参数传到对应的 Formbean 中,并设置 session
然后根据请求中的 Action 参数,在 struts-config
xml中查找指定的 Action,并调用此 Action 来处理请求
根据 Action 的处理结果,会返回一个 forward变量,此时通过 mapping
findForward()查找出对应的 forward 所标示的 Action 或者 JSP 页面,将请求转到下一个处理
如果是 forward 指向 JSP 页面,则输出到前台
Struts2:(1)客户端提交一个 HttpServletRequest 请求(