webwork에는 xwork.xml에 컨트롤러 dispatch정보를 기술을 한다.

webwork를 사용하면서 정말 좋다고 느낀 점중의 하나가, OGNL으로 사용하는 변수가 뷰단인 JSP, freemarker뿐만 아니라 configuration에서도 동적으로 셋팅이 된다.

내가 개발하고 있는 코드의 configuration이다.

<action name="TemplateWriteFormAsync"   class="TemplateWriteFormAsyncAction">
            <result name="success"            type="freemarker">/WEB-INF/view/${sourceType}_TemplateForm.ftl</result>
</action>


<action name="PostWrite" class="PostWriteAction">
           <result name="success" type="redirect">PostWrite.nhn?blogId=${blogId}</result>
</action>

action에서 sourceType의 getter를 만들어서 expose를 하면 configuration에서도 동적으로 값이 할당이 되서 url을 만든 후 dispatch가 된다는 이야기다.

이 점을 잘 이용하면, 매우 유연하게 Action의 dispatch를 잘 활용을 할수가 있다.
그 밖에 다양한 result지원으로 struts보다 한결 깔끔하고 막강한 configuration을 유지할 수가 있다.
Posted by ologist

블로그 이미지
ologist

공지사항

Yesterday191
Today135
Total34,707

달력

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

최근에 받은 트랙백

글 보관함