yoursyun
Action 인터페이스를 구현한 액션 본문
package tutorial;
import com.opensymphony.xwork2.Action;
// Action 인터페이스를 구현해서 만든 부분
// import com.opensymphony.xwork2.Action;
// implements Action
// @Override
public class HelloWorld implements Action {
private String message;
public String getMessage(){
return message;
}
@Override
public String execute() throws Exception{
message = "Hello World !";
return SUCCESS;
}
}
* 장점 : 코드의 정형화 (return SUCCESS;)
프레임웤이 excute()를 실행하기 위해 리플렉션을 사용하지 않아도 된다.
* 유효성 검사, 형변환, 모델 오브젝트의 사용을 위해서는 ActionSupport 클래스를 확장하는것이 좋다.
import com.opensymphony.xwork2.Action;
// Action 인터페이스를 구현해서 만든 부분
// import com.opensymphony.xwork2.Action;
// implements Action
// @Override
public class HelloWorld implements Action {
private String message;
public String getMessage(){
return message;
}
@Override
public String execute() throws Exception{
message = "Hello World !";
return SUCCESS;
}
}
* 장점 : 코드의 정형화 (return SUCCESS;)
프레임웤이 excute()를 실행하기 위해 리플렉션을 사용하지 않아도 된다.
* 유효성 검사, 형변환, 모델 오브젝트의 사용을 위해서는 ActionSupport 클래스를 확장하는것이 좋다.
반응형