Hi Don,
Thanks for the detailed response. WebWork sounds very nice indeed.
Don Brown wrote:
Overall, you'll find WebWork 2 and Spring MVC more similar than not,
with generally speaking WebWork 2 providing more features in areas, for
better, for worse.
snip
Furthermore, WebWork 2 has something similar to the HanderMapping called
the ActionMapper. This lets you have full control of how actions,
namespaces, and even parameters are coded into a URL. For example,
Patrick has developed a restful action mapper that lets you map the URL:
/books/view/book/Foo/chapter/1
to
Namespace: /books
Action: view
Parameters: book="Foo", chapter=1
Do you mind me asking what a namespace is and how it might be relevant
to Roller?
2) View independence through the SpringMVC View interface.
In WebWork 2, this is called a Result, and we have builtin support for
JSP, Velocity, Freemarker, JFreeChart, Jasper, XSLT, and a few others.
The current Roller blog UI uses a VelocityContext as its "result", which
easily maps to the Java Map interface which is what SpringMVC uses as
the "Model" in its ModelAndView return type. Can a result be just a Map?
I've spent a little time looking at WebWork 2.x and it seems to me
that it requires a greater degree of abstraction from Servlets and
HttpServletRequest/Response. That is why, at this point, I believe
SpringMVC would be a more natural choice for the BlogUI.
WebWork 2 also gives you access to the HTTP objects if you feel you need
them either through ServletActionContext.getRequest() or implementing
RequestAware if you prefer an IoC approach. I'd imagine the migration
from Servlet to Controller looks about what migrating to a simple Action
would look like.
So the question is: Is there a similar "lightweight" architecture we
could use based upon WebWork/SAF2.0?
I'm not sure how you could get much more lightweight than WebWork 2, so
perhaps a list of extra steps or hassles WebWork 2 would make you go
through would help me answer that question better.
I don't know what the extra steps would be, but in looking through the
Manning book at Borders, I got the impression that when using WebWork
you had to learn the WebWork abstractions and model to even do a simple
application, whereas with SpringMVC the Controller is a lot like a
Servlet. That was my impression, but, since I haven't really started
anything with it, I don't really know what I'm talking about...
That said, if Roller is considering upgrading to Struts Action 2, I'd be
more than happy to help out, as it would help us focus our migration
tools simultaneously.
I'd definitely like to see the Roller admin be ported to WW2/SAF2 since
I'm trying real hard to avoid learning Struts 1.x ;)
I'm prepared to sign up to finish the port of the Blog UI component to
SpringMVC, but don't think I'll have the time to learn WW2 and do the
work. If I can convince the committers to do it with SpringMVC, what
options does WebWork2 have for integrating SpringMVC controllers?
One neat feature (at least on paper, since I haven't used it yet) of
SpringMVC is that it has a mechanism for integrating Controllers/Actions
from other frameworks through something called a HandlerAdapter. Is
there something like this in WW2?
Perhaps, we (I) could finish the SpringMVC refactoring and then later,
once the admin UI is in WW2/SAF2 we could integrate it using an adaption
mechanism or just port it over to WW2.
In any case, moving the "view" code into a separate class from the
"controller" (Servlet) would be a step in the right direction.
Thanks, again,
Sean