'struts'에 해당되는 글 2건

  1. 2006/04/27 struts에서 token을 이용한 중복등록 체크 (10)
  2. 2006/04/21 Struts에서 Dynamic ActionFoward (10)

isTokenValid()메써드가 false를 반환하는 경우( at API)



  • No session associated with this request
  • No transaction token saved in the session
  • No transaction token included as a request parameter
  • The included transaction token value does not match the transaction token in the user's session
struts의 form태그를 사용하면 자동으로 토큰이 hidden으로 생성이 된다.
JSP페이지에 token이 생성되지 않는 경우 아래와 같은 토큰을 생성을 해준다.


<input type="hidden" name="org.apache.struts.taglib.html.TOKEN" value="<%=session.getAttribute(org.apache.struts.Globals.TRANSACTION_TOKEN_KEY)%>">
Posted by ologist
 TAG struts, token

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

공지사항

Yesterday191
Today137
Total34,709

달력

 « |  » 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      

최근에 받은 트랙백

글 보관함