'ActionFoward'에 해당되는 글 1건

  1. 2006/04/21 Struts에서 Dynamic ActionFoward (10)

Struts에서 동적으로 포워딩이 필요할때 사용하는 방법을 정리를 해봤다

1. ActionFoward 객체를 생성해서 리턴을 한다. 생성자에 URL이 파드코딩되므로 비추!
return new ActionForward("/index.html?paramKey1=" + paramValue1 + "&" +paramKey2=" + paramValue2 + "&" +paramKey3=" + paramValue3 ,true);

2. ActionMapping객체를 통해서 ActionFoward객체를 생성한다. 일반적으로 쓰는 방식
ActionForward actionForward = actionMapping.findForward(forwardName);
ActionForward actionRedirect =
new ActionForward(actionForward.getName()
,   actionForward.getPath()+"?param1=XXX&param2=XXX&param3=XXX"
,   true );
return actionRedirect;

3. org.apache.struts.action.ActionRedirect 클래스를 사용한다.
ActionRedirect redirect = new ActionRedirect( mapping.findForward(forwardName) );
  redirect.addParameter("param1", "XXX");
  redirect.addParameter("param2", "XXX");
  redirect.addParameter("param3", "XXX");
return redirect;

redirect .getParameterString()으로 넘어가는 파라미터 확인가능!!

ActionRedirect  API설명
http://struts.apache.org/struts-action/apidocs/org/apache/struts/action/ActionRedirect.html
: API설명을 보면 알겠지만, 스트럿츠 1.2.7부터 가능한 API이다

Posted by ologist
이전버튼 1 이전버튼

블로그 이미지
ologist

공지사항

Yesterday171
Today52
Total34,795

달력

 « |  » 2012.02
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      

최근에 받은 트랙백

글 보관함