aspose file tools*
The moose likes JSF and the fly likes JSF + AJAX + RichFaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF + AJAX + RichFaces" Watch "JSF + AJAX + RichFaces" New topic
Author

JSF + AJAX + RichFaces

Mahendra Chowdary
Greenhorn

Joined: Aug 26, 2010
Posts: 25
Hi , I am facing a error while trying to implement ajax functionality in my JSF page .

Please look into my code and help me out

My Jsf Page :



My Java Code Looks like this :



When i try to launch my application ,

before performing any action

one of the methods getFirstRadioChecked is being executed .

Why is it so ..

Why other methods are not executed .

But when i perform any action like selecting the first radio button , the method is not being called .

Please suggest how i can fix this .

Thanks
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
To answer your first question the getFirstRadioChecked is called because of this
rendered="#{addContact.firstRadioChecked}"

The getter will naturally have to be called to determine the value.

The other getters are not being called since you do not define the properties anywhere and you do not use them in rendered attributes either. For example you do not call the getter for secondRadioChecked anywhere in your code.

I do not know the syntax for a:support but are you sure that the action should look like this
action="#{addContact.firstRadioChecked}"

Normally (everywhere else where the action attribute is present) the action points to a method not a property. But I guess you have read the documentation and know what you are doing. I am (still) not familiar with richfaces taglibrary but I am beginning to think that it is a good thing

But maybe someone who has more experience with richfaces can help you more. At least you should add the term richfaces to your subject line since JSF does not equal richfaces
Mahendra Chowdary
Greenhorn

Joined: Aug 26, 2010
Posts: 25
To answer your first question the getFirstRadioChecked is called because of this
rendered="#{addContact.firstRadioChecked}"

The getter will naturally have to be called to determine the value.

Thanks for this Info But my intention is to get the true or false value after performing an action

So how can i achieve it now , i cant give rendered = "true/false" i need to determine whether it is true or false based on whether the button is selected or not


The other getters are not being called since you do not define the properties anywhere and you do not use them in rendered attributes either. For example you do not call the getter for secondRadioChecked anywhere in your code.

I do not know the syntax for a:support but are you sure that the action should look like this
action="#{addContact.firstRadioChecked}"

Yes it is in the same syntax

Normally (everywhere else where the action attribute is present) the action points to a method not a property. But I guess you have read the documentation and know what you are doing. I am (still) not familiar with richfaces taglibrary but I am beginning to think that it is a good thing

But maybe someone who has more experience with richfaces can help you more. At least you should add the term richfaces to your subject line since JSF does not equal richfaces

Will do that for sure

Mostly here we are not using much of the rich faces tag libs here
So i think the problem is not with the rich faces
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
Go Green wrote:
Mostly here we are not using much of the rich faces tag libs here
So i think the problem is not with the rich faces[/color]
Oh? I tought that the "a" in your code implied RichFaces ajax tags Ajax4Jsf. If they do not then it was my mistake. Is the "a" then some JSF 1 specific tag?

There is a "support" tag in richfaces taglibraries as well
http://docs.jboss.org/richfaces/latest_3_3_X/en/tlddoc/a4j/support.html
that has a action attribute that is supposed to point to a method, not a property.

And here is the full taglib
http://docs.jboss.org/richfaces/latest_3_3_X/en/tlddoc/

But I of course do not know what version of richfaces you are using or do you even use JSF 1 or JSF 2.

In any case in your code you have two a:support tags that are inside your f:selectItem tags. Maybe there should be only one a:support that is inside h:selectOneRadio? But I do not know.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF + AJAX + RichFaces