Tapestry Training -- From The Source

Let me help you get your team up to speed in Tapestry ... fast. Visit howardlewisship.com for details on training, mentoring and support!

Saturday, September 08, 2007

Itch scratching: Even better feedback for all thumbs typists

I was reading through Matt's rundown of Struts 2 (does it suck?) and he strayed into one of my most passionate areas: feedback.

He gave an example of an incorrect property name, and how that would be reported to the user. He showed examples from all the major frameworks, and the Tapestry 4 version, even without its proper CSS styles, won hands-down.

However, as I was reading and responding, it struck me that while other framework can barely tell you what you've done wrong, Tapestry 5 should be telling you how to fix it. In this case, advising you about the possible properties you could have specified, which I've added as TAPESTRY-1737 and fixed.

Here's the result. Not bad for ten minutes work. And remember: property names in Tapestry 5 are already case insensitive, which wipes out probably 50% of your typical typing errors anyway.


Anjan said...

hi howard,


What happens if the class has lots of properties ?

Let's say someone typed "mail" incorrectly.
should you be showing them properties that all start with "m" OR should you show them properties starting with adjacent characters in the charset "l" or "n".

how about adjacent characters in the keyboard "n", "k" (nothing starts with a COMMA(",") ).

Makes sense ?


Unknown said...

I've been thinking of ways in which the list of potential matches could be formatted better, including having the most likely match(es) highlighted ... but this is already light years ahead of any similar framework and I have bigger fish to fry.

Unknown said...

Wow, cool feature. Nice to have it at tapestry 4 ;-)

Steven, Michelle, Jakob, and Andy said...

As far a getting the correct property if the error is a mis-spelling, you could find the Levenstein Distance, and Apache commons StringUtils object has a nice getLevensteinDistance method.

Downside said...

Just use soundex from commons codec to match a similar sounding variable name. That's how spell checks work.

Unknown said...

Here's the difference between programming and software development: programming is easy and software development is hard. You have to budget your time, be disciplined, sometimes make compromises.

All this "suggest the right thing" stuff is doable, but low priority.

If you think it is very important, this is an excellent opportunity to do two things:

1) Add an issue requesting the new feature to Tapestry's JIRA
2) Submit a patch

As far as I'm concerned, nothing that isn't in JIRA exists. If it's important enough to someone to warrant a change, it's important enough for them to register with JIRA and add an issue. And if it's really important, they'll add a patch.

Martin said...

Does anyone know how to make T5 create all page instances at deploy time in Tomcat? For example, the Hibernate project suggests using a ServletContextListener to create a SessionFactory. Something similar would be great in T5 to get a better response time when the first user hits a page.
I know just doing requests from a utility class would be a quick-and-dirty workaround, but surely there has to be a better way.

Unknown said...

That's a discussion for the users list.

beanmac said...

Hi Howard,

I am new to Tapestry and to version 5. I am trying to use a page to pass in the parameter string to my layout component. Example, passing in a title from my page to my layout component. Also, trying to do this without using injection. Let me know if this is feasible.

Unknown said...


This isn't a support forum for Tapestry; users@tapestry.apache.org is a support forum for Tapestry, and you're much likely to get a timely answer there.