Wednesday, March 9, 2005

Silence Is Golden!

WARNING: This blog entry was imported from my old blog on (which used different blogging software), so formatting and links may not be correct.

Actually, that's just my excuse for not blogging much the last couple of weeks - and I haven't visited the
forum at all either.

I'm working feverishly on some new features for an internal milestone.

But I promise to come back and post early next week, so be sure to check back!

Oh, a parting tip: Be sure to place Message List components on ALL your pages. If an error is triggered
somewhere in your application, and this is detected in the JavaServer Faces code, it will typically log
an error message. If you don't have a Message List component on your page you won't see the error!

Furthermore, you can use the Message List components for simple "printf" debugging. Whenever you're writing
some code and it's not working - you can just use the debugger (it works, although sometimes requires the server
to be restarted in debugging mode). But a really quick & dirty way to see your results is to just call
the "error" method, which is defined in your page beans' super class. So just do this:

Object o = getValue("#{foo}");
// hmmmm I wonder what type o is?
error("DEBUG: The class of o is " + o.getClass().getName());

When you run, the Message List component will display your message (or set of messages, if more than one was
logged). This even works with multiple pages - let's say you put a Message List on each one of your pages.
If you put an error() call in the action handler for a submit button, then the message you
printed will show up on the new page you navigated to in its own Message List component!

Here's some more info about the Message List and notification mechanism. Be sure to scroll to the top and check out the rest of the article
too. I haven't read it yet (remember, I'm swamped at the moment) but I've glanced enough at it that I can
recommend it!

No comments:

Post a Comment