2009. 7. 27. 13:13
Web/Framework
사용 클래스 : com.opensymphony.xwork2.ActionChainResult
두 개의 다른 액션에서 처음 액션의 프라퍼티를 다음 액션에 세팅하고 싶을때 chain 인터셉터를 이용한다
예를 들어 회원등록 액션과 로그인 액션이 있는데
회원등록 후 그 정보로 이어서 바로 로그인으로 진행되게 한다
RegisterUser.java |
public class RegisterUser implements Action { private String userId; public String execute() throws Exception { |
LoginAction.java |
public class LoginAction implements Action { private String userId; private String password; private String message; public String execute() throws Exception { // 비지니스 로직 생략 return SUCCESS; } //getter, setter 생략 } |
struts.xml |
<package name="ex" extends="struts-default"> <action name="registerAndLogin" class="action.RegisterUser"> <interceptor-ref name="params"/> <result name="success" type="chain">login</result> </action> <action name="login" class="action.LoginAction"> |
'Web > Framework' 카테고리의 다른 글
[IBATIS] 파라메터클래스(parameterClass) 에 대한 고찰 (0) | 2009.07.27 |
---|---|
[STRUTS2] 인터셉터(interceptor) 에 대한 고찰 (0) | 2009.07.27 |
[STRUTS2] 네임스페이스(namespace) 에 대한 고찰 (0) | 2009.07.27 |
[STRUTS2] 와일드카드(*) 매핑 (0) | 2009.07.27 |
[STRUTS2] 파일 업로드 (FileUpload) (0) | 2009.07.27 |