Struts1.x原理图--时序图,xml配置

对应的时序图

 

public ActionForward execute(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
        throws Exception {

  // Was this transaction cancelled?
  if (isCancelled(request)) {
    if (log.isInfoEnabled()) {
      log.info(
          " "
            + mapping.getAttribute()
            + " - Registration transaction was cancelled");
    }

  removeFormBean(mapping, request);

  return (mapping.findForward("success"));
  }

  return mapping.findForward("success");
}

 

上面为何不直接在Action的方法中直接返回视图页面。而是把success对应的index.jsp放到配置文件中

实现的是解耦。在源代码中不能看到跳转的页面具体是什么了。

对应着struts-config中的

<!-- Registration Actions -->
  <action path="/registration" forward="/registration.jsp" />
  <action path="/registration-submit"
    type="org.apache.struts.webapp.validator.RegistrationAction"
    name="registrationForm"
    scope="request"
    validate="true"
    cancellable="true"
  input="input">
  <forward name="input" path="/registration.do" />
  <forward name="success" path="/index.jsp" />
  </action>

鸣谢: http://www.cnblogs.com/brucechen50/archive/2012/06/29/2570450.html
扩展: http://liuxi1024.iteye.com/blog/1113398
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值