Wednesday, January 14, 2004

Making a reuseable tile

After much righteous struggle, my programming pair figured out how to make a reuseable tile for Sruts, testing and all. The pieces are five:

  1. An actual tile (JSP file) and matching entry in the tiles definition file; this is fully reuseable
  2. A controller and display adapter to populate the tile, and tests for the controller; use an abstract base controller and test for the tile and specialize for each specific use
  3. An action and form to read the tile back, and tests for the action; use an abstract base action and test for the tile and specialize for each specific use
  4. Glue in the struts configuration file to hold it all together
  5. And methods in the service layer as data sources and sinks for the controller and action and tests

And all my tests are green.

I plan within the next few days to update Wisk with a demo of this pattern, but first I want to get @struts working — web.xml and taglib.tld but not struts-config.xml. Very odd.

Post a Comment