Archive

Archive for February, 2004

XDoclet Support for Struts DynaForms Updated

February 29th, 2004

I have updated the distribution bundle for my XDoclet plugin for Struts DynaForm support. No functional changes were made; this release just includes the other classes from XDoclet 1.2 Final. You can find the release here:

http://www.systemmobile.com/code/xdoclet-apache-module-sm-1_2.zip

The next release will include support for embedding Validator tags in POJO source files to generate the validation.xml file.

nick Uncategorized

Introduction to Hibernate Updated

February 29th, 2004

I have updated the example source code that supports my article, Introduction to Hibernate. The jars have been updated to Hibernate 2.1.2, and extraneous jars have been removed. This should clear up some of the problems that people were having.

nick Uncategorized

Book Crossing

February 24th, 2004

I ran across a flyer for Book Crossing at a local coffee shop. Looks like a pretty cool idea. Basically, you register a book with them, put the registration number inside the front cover, and leave it someplace for people to find. When they find and read the book, they review it on Book Crossing and leave it in a public place for the cycle to start over.

Let me know if you’ve tried this, or found a BC book.

nick Uncategorized

Project Reflections

February 22nd, 2004

I will be completing a very large client project in the next few weeks. As part of the impending wrap-up, I have been reflecting on the technical problems that I have had since starting the project in earnest. The major technologies used were:

  • Struts, Tiles, JSPs
  • Tomcat
  • Hibernate
  • XDoclet
  • JUnit, StrutsTestCase, etc…

The development process was pretty simple overall. The flexibility gained by using XDoclet and Hibernate turned hours of tedious work into minutes of trivial editing. Struts and Tiles required, as usual, far more work than they should, but using the DispatchAction class saved a good deal of time.

Converting the dynamic form objects into their respective POJOs demanded the most time, with implementing complex business rules second. I initially hoped the BeanUtils package would make this simpler, which it did to an extent, but it is still lacking.

I believe that a project-specific abstraction layer should have been created, wrapping BeanUtils classes to make domain-specific conversions simpler. For example, converting arrays of Longs into respective Sets of POJOs needs to be handled, which should become more transparent with Java 1.5 and generics. The BeanUtils class doesn’t seem to work with converting nested properties even if a custom Converter class is registered. This could be a shortfall or an oversight on my part. Either way, too much work was required.

Date handling in a web application can also be quite the mess, especially if you present the date in various input formats. I have a popup calendar with an associated text field for the year-month-day, along with select lists for the hour, minute, am/pm select lists for the start and end times - not a fun way to handle dates when converting back to java.util.Date instances.

If you have creative solutions to these problems, please let me know. Otherwise, I’m just going to figure something out and add it to my toolbox of neat toys.

nick Uncategorized

Ant Tip

February 17th, 2004

A little-known Ant feature is the hyphenated target name. If you have a target name that starts with a “-”, such as “-test-setup”, you will not be able to call that target from the command line. Developers creating utility targets in their build.xml files can use this to avoid confusing other developers with irrelevant support targets.

The documentation on this feature can be found here: http://ant.apache.org/manual/using.html#targets

nick Uncategorized

DisplayTag and Struts/Tiles

February 4th, 2004

After reading Matt Raible’s email on the struts-user mailing list about his improvement to the excellent DisplayTag library, I decided to give the latest CVS source a try. The core of his fix deals with exporting data from a Tiles application. If you try to export data without his fix, the data will show up in the JSP page since Tiles essentially overrides the RequestDispatcher.

I checked out the latest code, compiled and tested, but the exported data was still showing up in the JSP - I wasn’t being prompted to save the file. It turns out that his fix didn’t make it into CVS, which was likely a Sourceforge problem. I found the problem and emailed Matt about it. He’ll probably commit the fix shortly.

Another feature that I added to my local version was setting the Content-Disposition header so the IE will (hopefully) deliver the file with the proper name and not with that annoying .do extension. Once it’s tested I’ll email the developers to try to get it included as well.

nick Uncategorized

Potato and Clam Chowder

February 1st, 2004

Now for something different…

4 - medium potatos, chopped
5 - bacon strips, chopped
2 - celery stalks, chopped
2 - small onions, chopped
1 - carrot, grated
2-3 - garlic cloves, minced
1/4 cup (50mL) - flour
2 cans - 5oz (142g) clams
1 can - 12oz (385mL) evaporated milk
2 1/2 cups - milk
1/4 tsp (1mL) - dried basil
1/4 tsp (1mL) - pepper
1/4 tsp (1mL) - salt

Cook potatoes in 1 cup of water and the drained clam juice. Cover potatoes and bring to a boil, reduce heat and simmer until tender (15-20 minutes). Meanwhile in a skillet over medium heat, cook the bacon, celery, onions, carrot and garlic, stirring occasionally until the bacon is cooked (10-15 minutes). Sprinkle with flour and stir to combine. Add to the potatoes and stir gently. Add milk and cook over medium heat, stirring frequently until mixture simmers gently and thickens. Add clams, basil, salt and pepper and heat thoroughly. Makes 8 servings.

nick Uncategorized