This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JSF and the fly likes Backing Bean Behaviour on MyFaces using A4J Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Backing Bean Behaviour on MyFaces using A4J" Watch "Backing Bean Behaviour on MyFaces using A4J" New topic

Backing Bean Behaviour on MyFaces using A4J

Pamungkas Timotius

Joined: May 22, 2005
Posts: 26
I'm new at Ajax and JSF/A4J, and I'm trying to learn the very basic of it, but I found that behaviour for A4J is quite different from standard JSF (either RI or MyFaces). The first screen I made is login screen. Normally, using <h:commandButton>, when action controller method was called, whole page will be refreshed. Expecting following behaviour, I'm trying A4J:

1. When button "Login" was clicked, page will display message, such as "Validating user xxxxxx, please wait" and the login button itself will be disabled until request complete.
2. When request complete, hide message "Validating user xxxxxx, please wait", and (since this is Ajax studying) instead of redirecting page, I want the Login button to re-enabled.

So I write following jsp code

while this is the backing bean

But this approach does not work, the message "Validating user xxxx, please wait" is displayed after I clicked button Login, while the request itself still processed at server, but button login still enabled.
After validateLogin() complete, message still displayed, and no changes on button login.

So I try the second approach, based on Richfaces' user guide. Instead of disabling button at backing bean, I do it via jsp as follows

OK, the button behave as expected, but no "Validating user xxxx" message displayed.

I think I can't reference component, changing it's visual behaviour from backing bean, since the page is not reloaded all, Can I? So how can I get those behaviours?

Another question, when I add code at validateLogin() as follows:

How can I display appropriate error message?
Any references or solution? My google search did not find anything useful

I agree. Here's the link:
subject: Backing Bean Behaviour on MyFaces using A4J
jQuery in Action, 3rd edition