Sunday, March 4, 2007

Upgrading to Webwork 2.2.5

I've been working on a project for the past months. In this project we use Webwork 2.2.4 as the presentation framework.

Last week, I tried to upgrading to 2.2.5(svn) which has upgraded to use Dojo 0.4.1. First I check out the source from http://svn.opensymphony.com/svn/webwork/trunk. Then I build and test the showcase example. So far so good.

Migrating to 2.2.5


I took a quick look at the setup of the showcase example: web.xml, webwork.xml and webwork.properties. It look like there is nothing incompatible. So I proceed to try it out with my project. I replaced the two jars (webwork.jar and xwork.jar) and fire up the application.

When I point the browser to the application, I got a bunch of javascript error, this is what reported by FireBug:
GET http://localhost:8080/fow225/src/storage/__package__.js 404 (21ms)dojo.js
symbol 'dojo.storage' is not defined after loading '__package__.js' throw _13||Error(_12);
Looking at the same in the showcase example:
GET http://localhost:8080/showcase/webwork/dojo/src/storage/__package__.js (60ms)
So Dojo is not able to require the javascripts. Look simple enough: in 2.2.4, you tell Dojo where to load it's file in template/ajax/head.ftl:
djConfig = {
baseRelativePath: "<@ww.url includeParams='none' value='/webwork/dojo/' encode='false'/>",
isDebug: ${parameters.debug?default(false)},
bindEncoding: "${parameters.encoding}",
debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes
};
But the baseRelativePath is missing in 2.2.5. I spent hours tring to figure out why it works for the showcase example but not for my application, but got nowhere. So for now, I just override head.ftl by creating a template/ajax/head.ftl in my application root.

If you happened to know the answer, please leave a comment.