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을 유지할 수가 있다.
webwork를 사용할 때 model driven으로 데이터를 populate는 하는 방법이 있다.

webwork in action책 P.90 advanced input부터 살펴보면 더 자세한 내용을 알수가 있다.

P.93에 있는 Advantage of using domain objects를 보면 우리가 도메인 객체를 디자인하고 EJB의 DTO나 struts의 FORM객체가 없이 POJO객체로 비즈니스 로직에서 사용하는 객체에 바로 데이터를 담을수 있다. 하지만, P.94에 보면 model driven의 단점도 나와있다. 장단점을 꼭 확인하고 사용을 해야겠다.

webwork에서 model driven을 사용하려면 반드시 interceptor를 2개 추가를 해줘야 한다.
이거 생각보다 삽질하는 사람이 많다. 꼭 주의해라!! 2개의 intercepter를 추가해야 한다.

보통 아래 params 인터셉터를 빼먹고 오픈심포니를 욕하는 사람들이 많다는 이야기!!

<interceptor-ref name="model-driven"/>
<interceptor-ref name="params"/>
1. Preparing skeleton
- xwork.xml : action, result, interceptor configuration
- webwork.properties
- xwork.jar
- velocity-dep.jar
- ognl.jar

- common-logging.jar
- web.xml

struts와 비교 했을때 거의 비슷하다. xwork.xml과 webwork.properties는 웹컨텍스트의 클래스패스 ROOT에 넣어둔다.(ex. WEB-INF/classes/)

2. 개발순서 : struts와 같다.
  • Action클래스를 만든다.
  • jsp를 만든다
  • xwork.xml에 action과 jsp를 맵핑해준다.
struts진영의 발표로 struts와 webwork가 합쳐진다는 것은 모두다 아는 사실이지만, 사실상 webwork팀에 주도로 앞으로의 struts의 모습은 webwork를 통해서 볼수 있을 듯 하다.

WebWork joining Struts
http://blogs.opensymphony.com/webwork/2005/11/webwork_joining_struts.html
XWORK is a generic comman pattern framework.

http://www.opensymphony.com/xwork/wikidocs/Introduction.html

The Purpose
  • To create a generic, reusable, and extensible command pattern framework not tied to any particular usage.


Features
  • Flexible and customizable configuration based on a simple Configuration interface
  • Core command pattern framework which can be customized abd extended throgh the use of intereptors to fit any request/response environment
  • Built in type conversion and action property validation using Ornl
  • Powerful validation framework based on runtime attribute and a validation interceptor.

XWork is an command-pattern framework that is used to power WebWork as well as other applications. XWork provides an Inversion of Control container, a powerful expression language, data type conversion, validation, and pluggable configuration.

http://www.opensymphony.com/xwork/wikidocs/Documentation.html



How does XWORK relate to Webwork
Webwork 2.0+ is built on top of XWORK and povides web-specific features that allow you to quickly build web applications using XWORK`s command pattern and interceptor framework.

Webwork Book

2006/05/02 09:33

webwork만 전문적으로 다룬책이 국내에는 없다.
네이버 책으로 검색을 날려봤다. 역시 이 책 밖에 없는 것이구나.
국내외를 제외하고 책이 별로 없다.

일단, 이 책을 사는 것은 보류한다. 웹에 문서를 가지고 스터디 후에 부족할 듯 하면, 그 후에 보도록 하자~

Webwork in Action

Patrick Lightbody,Jason Carreira / Oreilly & Associates Inc

Webwork SiteMesh

2006/05/02 09:33
SiteMesh가 언제 쓰는가 하면~

SiteMesh is a web-page layout and decoration framework and web- application integration framework to aid in creating large sites consisting of many pages for which a consistent look/feel, navigation and layout scheme is required.

http://www.opensymphony.com/webwork/wikidocs/SiteMesh.html

Webwork Architecture

2006/05/01 19:48

webwork를 배워야 하는 시점이 왔다. 프레임워크를 항상 나 자신이 필요에 의해서 사용을 했었다. Struts, iBATIS(DAO framework), Spring, ... , etc

그러고 보니 별로 사용한것도 없네...^^;

처음으로 타인에 의해서 써야 하는 상황을 맞이했다. 전사적으로 사용하는 것이라 어쩔수 없기도 하고, 기분이 좀 묘하기는 하지만~ 이왕 써야 하는거 잘 써야 하니깐, 준비를 좀 하기 위해서 스터디 시작~!

무엇이든지 뼈대와 아키텍쳐를 먼저 이해하면 detail한 것은 경험으로 얻어야 하는 것이지!!

구글 신에 물어봤다 "Webwork Architecture"
가장 상단에 뜬 링크이다. 역시 내가 좋아하는 그림이 있다...ㅎㅎㅎ
http://wiki.cs.uiuc.edu/cs427/WebWork+Architecture


이 그림을 보고, 역시~!! 그냥 MVC군!! Struts와 별로 다를게 없다.

1. Decouples presentation and logic into separated conponents.

2. Provides a central point of control.

3. Encourages the use of standarlized components.

잘 아는 내용이지만, 과연 이대로 개발을 하는지는 의심스럽다. 난 가급적 할려고 노력하기는 하는데...ㅎㅎㅎ

webwork를 개발한 곳에서 아키텍쳐를 소개하는 링크이다. 아무래도 만든 곳에서의 소개나 레퍼런스가 가장 정확하고, 신뢰할만한 이야기들이 담겨있을 것이다.
http://www.opensymphony.com/webwork/wikidocs/Architecture.html


오~ 훌륭한 모습이다. 조금은 복잡하기도 하지만, J2EE개발시 필요한 레이어가 모두 존재하는 그림이다.


BLOG main image
OOP and Java by ologist

공지사항

카테고리

All (649)
private!! (106)
WEB & IT (140)
Developer (400)