課程
/后端開發(fā)
/Java
/Struts2攔截器淺析
為什么最后一個System.out.println("執(zhí)行Action花費的時間:" + (end - start) + "ms");沒輸出到控制臺
2016-05-06
源自:Struts2攔截器淺析 3-3
正在回答
@Override
public String intercept(ActionInvocation invocation) throws Exception {
System.out.println("執(zhí)行Action之前");
// 1.執(zhí)行Action之前
long start = System.currentTimeMillis();
System.out.println("執(zhí)行下一個攔截器,如果已經(jīng)是最后一個攔截器,則執(zhí)行目標Action");
// 2.執(zhí)行下一個攔截器,如果已經(jīng)是最后一個攔截器,則執(zhí)行目標Action
String result = invocation.invoke();
System.out.println("執(zhí)行Action之后");
// 3.執(zhí)行Action之后
long end = System.currentTimeMillis();
System.out.println("執(zhí)行Action花費的時間:" + (end - start) + "ms");
return result;
}
發(fā)現(xiàn)攔截器完全沒有執(zhí)行,后來檢查到攔截器配置問題-----------包名有個字母大寫,汗,細節(jié)
舉報
本視頻教程將代領(lǐng)大家了解Struts2攔截器的工作原理及配置
2 回答出事了出事了
3 回答直接訪問action出錯啦,怎么回事
2 回答把老師的代碼載了下來,但是啟動TomCat時出現(xiàn)配置文件無法載入的情況是什么回事?。?/p>
1 回答快來看看怎么回事????
3 回答根據(jù)老師的代碼,報錯,找不到index方法,請問配置哪里出錯了,謝謝。
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-05-07
@Override
public String intercept(ActionInvocation invocation) throws Exception {
System.out.println("執(zhí)行Action之前");
// 1.執(zhí)行Action之前
long start = System.currentTimeMillis();
System.out.println("執(zhí)行下一個攔截器,如果已經(jīng)是最后一個攔截器,則執(zhí)行目標Action");
// 2.執(zhí)行下一個攔截器,如果已經(jīng)是最后一個攔截器,則執(zhí)行目標Action
String result = invocation.invoke();
System.out.println("執(zhí)行Action之后");
// 3.執(zhí)行Action之后
long end = System.currentTimeMillis();
System.out.println("執(zhí)行Action花費的時間:" + (end - start) + "ms");
return result;
}
發(fā)現(xiàn)攔截器完全沒有執(zhí)行,后來檢查到攔截器配置問題-----------包名有個字母大寫,汗,細節(jié)