Loading Twitter updates Loading...
Follow me on Twitter
20040227 Friday February 27, 2004

Pictures from Tucson Last weekend, we headed to Tucson, Arizona to visit with family. Here are some good pics from the trip - and one of Abbie with her new kitty.

Trains
Cool Trainyard
Trains
El Charro
Trains
Saguaro National Park
Trains
Abbie giving Zoe a kiss

Posted in General at Feb 27 2004, 10:43:32 PM MST Add a Comment

Generating indexed-property ready ActionForms with XDoclet One of the issues with using XDoclet to generate your Struts ActionForms (from POJOs) is that out-of-the-box, your Forms will not support indexed properties. This means that if you have a List on an object (this list will likely contain other objects/forms), you have to extend the generated form to add the necessary setters for indexed properties. For example, if you have an addresses List on a PersonForm, you would need the following in order to edit those addresses in Struts.

    setAddresses(int index, Object address) {
        this.addresses.set(index, address);
    }

The worst part is that you need to populate the addresses list with a bunch of empty AddressForm objects before Struts' auto-population will succeed. If you were coding the PersonForm by hand, you could code a reset() method such as the following:

    public void reset(ActionMapping mapping, HttpServletRequest request) {
        this.addresses = ListUtils.lazyList(new ArrayList()new ObjectFactory());
    }

    /**
     <code>StringFactory</code>
     *
     @see org.apache.commons.ListUtils
     */
    class ObjectFactory implements Factory {

        /**
         * Create a new instance of the specified object
         */
        public Object create() {
            return new AddressForm();
        }
    }

Now for the best part - I figured out how to generate this code with XDoclet, so any lists on your Forms will be indexed-property ready. By using <nested:iterate> in your JSP, you can easily CRUD you indexed properties. Pretty slick IMHO. The template is a bit much to put on this site, and it's long lines won't fit in a <pre> - so you can temporarily view the template here. I'll add a link to it in AppFuse's CVS once it shows up there. One thing you'll notice in this template is a little Velocity-lovin':

<XDtVelocity:generator>
  #set( $method = $currentMethod.name)
  ## trim off the 'get'
  #set( $objectName = $method.substring(3, $method.lastIndexOf('s')))
</XDtVelocity:generator>

Thanks to Erik on Merrick's blog for the quick Velocity/XDoclet howto. It was especially helpful since the XDoclet site has no documentation on this feature.

For all you my framework is better junkies - a clear explanation of how your framework handles indexed properties would be appreciated.

Posted in Java at Feb 27 2004, 05:18:10 PM MST 2 Comments

New Phone? I just got an interesting SMS message from AT&T:

AT&T Wireless: Sony 
Ericsson and AT&T
Wireless have sent 
you a new T226
phone to replace
your current T68 -
no strings attached.
Questions? Call
800-500-3821.

Wierd eh? Is there something wrong with the T68i? I'll admit that the T226 looks a bit nicer, but when I get a new phone - I'd like to go all out. In other words, I'll be talking to Russ to get his recommendation. Posted in General at Feb 27 2004, 03:10:56 PM MST 4 Comments

Struts 1.2.0 Test Build Available From the struts-dev mailing list:

The Struts 1.2.0 Test Build is now available here:

http://www.apache.org/~martinc/struts/v1.2.0/

This is the first Struts build being made available following the same
test-and-release process that has been used successfully by the Tomcat
team for some time. It is *not* an official Apache release.

Once feedback has been collected on the stability and general quality of
this build, a determination will be made as to whether it should be
promoted to Alpha status.

You can reference the Struts site for a list of what's changed since 1.1. To further assist you (if you're upgrading from 1.1), you might want to check out how I did it back in October. I tested this build with AppFuse and all tests pass - I didn't even have to change a single line of code. For that reason, this is now the Struts version that'll ship with AppFuse 1.4. Posted in Java at Feb 27 2004, 09:06:43 AM MST Add a Comment

20040226 Thursday February 26, 2004

No Fluff Just Stuff I had lunch today with Jay Zimmerman of No Fluff Just Stuff. I always enjoy getting together with Jay because he's from Montana and Montanans are generally nice folks. Among other things, he asked if I would be interested in speaking at a NFJS event or two. I said I'd think about it. However, I'm strongly considering it since it would probably be a good marketing tool.

I probably wouldn't do any events until sometime this summer. Now I just have to figure out what I'd speak on... Posted in Java at Feb 26 2004, 01:46:06 PM MST 6 Comments

20040225 Wednesday February 25, 2004

Cool Blog Design I dig Dunstan Orchard's blog theme. I especially like his comment alert system and right-nav tabs (main, b-marks, b-roll). There some inspiring stuff here - adding a similar comment alert system and theme are on my Roller wishlist. Now if I could just find time to do them...

Later: Some more cool designs. Posted in Roller at Feb 25 2004, 02:55:44 PM MST 6 Comments

Time for new business cards The last time I got Raible Designs' business cards was when I first started the company - way back in 1998. I still have a couple boxes left, but with all the networking opportunities in my future - it's about time I got some new ones. So I'm looking for recommendations of good business card designers/printers. Maybe I should host a contest and give away an iPod to the winner? ;-)

As a sidenote, what do you think about putting the cert icons (i.e. MSCE and SCJP) on business cards? I think it was cool when I first got certified, but now it seems pointless. It just takes up space and would probably take away from a nicely designed card. Posted in General at Feb 25 2004, 10:54:55 AM MST 2 Comments

Supporting OGNL in Tag Libraries Adding support for JSTL's Expression Language was fairly easy to do in the Display Tag. It was as simple as adding an ExpressionEvaluator and subclassing the ColumnTag and the TableTag. From there, all that was needed was needed a new TLD to reference these new classes.

So the question is - would it be just as easy to support the OGNL Expression Language? Does it have an ExpressionEvaluator I can write with the same simplicity as the JSTL version? If I could figure that out, I think creating OGNL-aware versions of the displaytag and struts-menu would be a piece of cake. All you'd need to do would be to change you're TLD's URI and you'd be off to the races! Posted in Java at Feb 25 2004, 10:43:08 AM MST 3 Comments

How do you get around Struts' single inheritence model? Adrian Lanning sent me an interesting e-mail yesterday. He's looking for a better way to extend Struts. I thought I'd post his message here and see if anyone has ideas.

I am a big struts fan and use it for my projects but I think there is something fundamentally wrong with the design. The real crux of the matter may be that Java is a single-inheritance model and Struts is designed more for multiple-inheritance.

Example 1.
Complexity when trying to use "extensions" to struts that have their own RequestProcessors. Such as my extension for roles (mentioned below) used together with Asqdotcom's ActionPlugin which is a plugin but still uses its own RequestProcessor, plus another hypothetical extension which has it's own RequestProcessor. Basically the only way to use them all is to modify the source of one or two to extend the others which doesn't seem like a good design.

Example 2.
Extending LookupDispatchAction to include per-method validation (set in struts-config.xml). Basically same problem. Need to combine functionality of ValidatorAction and LookupDispatchAction but can't extend from both. Have to modify source. Actually Brandon Goodin wrote this already (I find it very useful). It's called ValidatorLookupDispatchAction.

I know this is a common issue with single-inheritence models/languages. It would be really easy to extend Struts in a multiple-inheritance model.

* THE POINT *
I was just wondering if you knew of a better way to design when dealing with single-inheritance models to avoid problems such as these.

Personally, I don't find the need to extend Struts that much, so this is not much of an issue for me. I think Struts 2.0 will solve many of Struts single-inheritance design by declaring interfaces for all core components. I wonder when 2.0 is roadmapped to ship - sometime in 2006? ;-)

Later: The article, Security in Struts: User Delegation Made Possible, by Werner Ramaeker provides a good example of a Struts extension strategy. Posted in Java at Feb 25 2004, 04:00:05 AM MST 23 Comments

20040224 Tuesday February 24, 2004

Upgraded to Tomcat 5.0.19 + thoughts on Resin I spent 5 minutes tonight and upgraded this site to use Tomcat 5.0.19. Everything seems to be working fine, save for a couple of new messages in catalina.out:

24-Feb-2004 7:48:34 PM org.apache.jk.common.HandlerRequest decodeRequest
WARNING: Error registering request
24-Feb-2004 7:48:44 PM org.apache.jk.common.HandlerRequest invoke
INFO: Unknown message 0

After talking with Rick last weekend, I'm going to try and migrate to Resin as my main dev appserver. The motivating factor was hearing Resin and Orion are so much faster than Tomcat. Sure I've heard this many times before, but mostly from Jakarta-haters. Rick's opinion holds a bit more water for me. Of course, he mentioned that his findings where based on Resin 2.x and Tomcat 4.x. I'd love to see a performance comparison between the latest versions of Orion, Resin and Tomcat.

I hope to modify AppFuse so it can easily run with Tomcat or Resin with a simple property switch. I've already started that process, but I hit a small snag.

I also hope to migrate this site to Resin 3.x soon. If nothing else, it'd be nice to learn more about Resin - and we all know the best way to learn a new technology is to interact with it on a daily basis. Posted in Java at Feb 24 2004, 08:01:10 PM MST 11 Comments