Struts 에서 action 으로 forward 할 경우 parameter를 넘겨주는 방법
게시글에 댓글을 쓸 경우 댓글을 DB에 저장하는 Action을 호출한 후 다시 그 게시글로 돌아와야하는데
forward를 사용하면 parameter를 넘겨줄 수가 없었다.

찾다찾다 방법을 알아냈는데..

출처 : http://greenwebber.tistory.com/56
ActionForward forward = mapping.findForward("success");
ActionForward redirect = new ActionForward(forward.getName(), forward.getPath() + "?paramName=" + paramValue, true );
return redirect ;

더 많은 방법이 있지만 현재 사용하고 있는 Struts 버전이 1.1 이라서 이 방법이 최선이다.
ActionRedirect 는 1.2x 버전부터 되는 것 같았다.



반응형