Tuesday, 11 July 2006

Struts 1.2.9, html:cancel and hours of fun

Let the rant begin.

I've had lots of fun today with struts html:cancel button. Too much fun. *cough*

My problem with the widget is that it is designed to be a cancel button only when you don't specify a value for the "property" attribute. But it allows you to specify a value for that.... let me say that again a different way: it allows you to remove all it's functionality if you just specify an attribute that you would on just about every other control. Why you ask? I have no idea.

I find the whole thing funny and sad at the same time. You have methods designed to check for a specific pram. Then they make it super easy to remove the pram. I'm just ticked off about the time that I wasted today.

And I am not even talking about how much time I wasted to find out the if I want to use above mentioned cancel button I will have to make note of it in my mapping file. No, it doesn't print a helpful message (that I saw), it just seemed to die. It wouldn't even enter in the cancelled method in my LookupDispatchAction. No, it just throws an exception.

Whew... for all that struts does for me, some times (most times) I wish that I didn't have to manage it so closely and know all the in's and out's. I've been using it for a while now and I am still learning most days. Not because I am dumb (I hope), but that it's just so freaking big. Design gone wild to be able to be the utmost flexable...

Sometimes I don't want a swiss army knife. Sometimes I just want a really big hammer.

5 comments:

  1. It does seem like a weird behaviour. However, it's outlined for you in the documentationt that this is the way the property attribute works. It probably shouldn't be this way, but it says so right in the documentation.

    ReplyDelete
  2. Yes, it says so right in the doc. If you look at the doc, and that *exact* attribute. They could have put a note in the summary of that doc...
    I don't think that it's consistent with how the other widgets work. That and the fact that as soon as you set that property (an easy mistake if you ask me), then it totally removes all the behaviour of a "cancel button". As soon as a "property" is supplied, it's behaviour is no different than a submit button.
    Why wouldn't they just not allow you to set a property? If you do a search on the net there are LOTS of people who have had this problem.
    I don't think that Struts did a good enough job of protecting the users of this framework in this case. But that's my 2 cents.

    ReplyDelete
  3. Yeah, like I said, it probably shouldn't work this way. If they can't get rid of the attribute, becuase it's in the base class, then they should at least override it and throw an exception with a nice output message of why the exception is being thrown when you try to use it. It is completely useless to have a propery on an object that completely and unexpectedly changes the object like that.

    ReplyDelete
  4. Isn't Kibbee the name of some sort of dog food?

    ReplyDelete
  5. hahaha... that, or a last name. ;-)

    ReplyDelete