欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
2.5.1 Action實(shí)現ModelDriven接口后的運行流程
1、先會(huì )執行ModelDrivenIntercept的intercept方法

public String intercept(ActionInvocation invocation) throws Exception {
    //獲取 Action 對象: EmployeeAction 對象, 此時(shí)該 Action 已經(jīng)實(shí)現了 ModelDriven 接口
    //public class EmployeeAction implements RequestAware, ModelDriven<Employee>
        Object action = invocation.getAction();

//判斷 action 是否是 ModelDriven 的實(shí)例
        if (action instanceof ModelDriven) {
        //強制轉換為 ModelDriven 類(lèi)型
            ModelDriven modelDriven = (ModelDriven) action;
            //獲取值棧
            ValueStack stack = invocation.getStack();
            //調用 ModelDriven 接口的 getModel() 方法
            //即調用 EmployeeAction 的 getModel() 方法
            /*
            public Employee getModel() {
employee = new Employee();
return employee;
}
            */
            Object model = modelDriven.getModel();
            if (model !=  null) {
            //把 getModel() 方法的返回值壓入到值棧的棧頂. 實(shí)際壓入的是 EmployeeAction 的 employee 成員變量
            stack.push(model);
            }
            if (refreshModelBeforeResult) {
                invocation.addPreResultListener(new RefreshModelBeforeResult(modelDriven, model));
            }
        }
        return invocation.invoke();
    }
   
2、 執行 ParametersInterceptor 的 intercept 方法: 把請求參數的值賦給棧頂對象對應的屬性. 若棧頂對象沒(méi)有對應的屬性, 則查詢(xún)值棧中下一個(gè)對象對應的屬性...

3、注意: getModel 方法不能提供以下實(shí)現. 的確會(huì )返回一個(gè) Employee 對象到值棧的棧頂. 但當前 Action 的 employee 成員變量卻是 null. 

public Employee getModel() {
return new Employee();
}    
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
【Struts2進(jìn)階】Struts2深度解析ModelDriven原理
ModelDriven使用
Struts2之ModelDriven的使用
模型驅動(dòng) ModelDriven
使用ModelDriven action
Struts2.1.6+Spring2.5.6+Hibernate3.3.1全注解實(shí)例詳解(五)
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久