2007/06/04 19:42 Developer
webwork ognl을 이용한 dynamic dispatch configuraiton설정
webwork에는 xwork.xml에 컨트롤러 dispatch정보를 기술을 한다.
webwork를 사용하면서 정말 좋다고 느낀 점중의 하나가, OGNL으로 사용하는 변수가 뷰단인 JSP, freemarker뿐만 아니라 configuration에서도 동적으로 셋팅이 된다.
내가 개발하고 있는 코드의 configuration이다.
action에서 sourceType의 getter를 만들어서 expose를 하면 configuration에서도 동적으로 값이 할당이 되서 url을 만든 후 dispatch가 된다는 이야기다.
이 점을 잘 이용하면, 매우 유연하게 Action의 dispatch를 잘 활용을 할수가 있다.
그 밖에 다양한 result지원으로 struts보다 한결 깔끔하고 막강한 configuration을 유지할 수가 있다.
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>
<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을 유지할 수가 있다.