Tuesday, September 28, 2010

Specific error messages mystery solved.

At the beginning of this month, I wrote about a problem I faced after upgrading JBoss 4 to JBoss 5. I have a class that validates information. When user clicked a button, it first calls that validator method, which in turns return a true or false value. If validation passes, the user can proceed, otherwise, the user cannot process and the page is re-rendered with error messages. The problem I faced was that all the messages are appearing at the global level instead of specific component.

In the code, I used <rich:message for="componentId" /> for error messages.

After contacting JBoss support and a few test cases, I solved the problem. The problem was that when the validation failed, I return the page by writing return "page1.xhtml" in my code. If I changed that line of code to return "", the error messages are rendered at the right location.

No comments:

Post a Comment