Saturday, January 17, 2009


I was doing some research on JSF custom components. I saw that one way to do AJAX in your custom components is to program the code needed to get your data right in your decode() in your component or in your renderer.

The problem I was having was that when I told the AJAX code to do the POST it was not acting in JSF request lifecycle like a postback had occurred. It was only running the first and last phases of this it does when you first visit a page.

The solution? Apparently JSF determines if this page was a postback by looking at all the input fields (or textarea, etc), and seeing if they have a name attribute. If they do then they need to have an entry in the post "search area" that you send as a string to the AJAX "send" command. So that includes state saving field, and any other fields that are displayed or hidden that have a name...I think.

Anyway doing this got my decode() method to be called, and the JSF lifecycle to call all the phases.

No comments: