ว่าทำ action นี้แล้วไปที่ view ไหน (โดยดูจาก outcome ) คล้ายๆกับ findforward ใน Struts น่ะครับ
ส่วน actionListener นั้นเป็น event handler จากการทำ action นี้น่ะครับ
ไม่มีการเปลี่ยน view
อีกอย่าง method signature ของทั้งสองจะต่างกันด้วย โดยตัว method ของ actionListener นั้นจะมี argument ที่เป็น ActionEvent ด้วย เช่น
public void doIt(ActionEvent event){
...
}
method signature ของ action นั้นจะไม่มี argument แต่จะ return String ที่เป็น outcome ของ action ออกมาแทน เช่น
public String login() {
if ( ... ) // login is successful {
return "success";
} else {
return "failure";
}
}
Note:
actionListener ถูกทำก่อนครับ แล้ว action จะถูกทำทีหลัง
Credit:
http://www.narisa.com/forums/index.php?showtopic=7176
ไม่มีความคิดเห็น:
แสดงความคิดเห็น