• Post Reply Bookmark Topic Watch Topic
  • New Topic

RichFaces and Partial JSF rendering or update

 
wadha alketbi
Ranch Hand
Posts: 56
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good afternoon,

I have this case in JSF using Eclipse:

I have 3 inputs, 2 of them are date "Rich calendar" and the third one is to show a result of calculation "inputText".
What I want is to do a partial update in the result without submitting the form so I mean when the date 1 and date 2 is entered the calculation will be done and the result of the calculation will be shown in the third value "result"

So I use the a4j:support and the actionListener is work but the problem is the result showing only in the DB when I click save button without showing in the page so, it dose not reRender the value or may be there is no partial update in the page.

In the BackBean, I divide my code to method that take ActionEvent and inside it I call the method that is handling the change when the Date 1 & 2 entered. Also I have the method that calculate the result.

This is my JSF:





In the BackBean:




I have anther class that include the start, end date and requiredDays whit setters and getter methods "AddDto".

Is this case is related to something call it "a4j:region tag" or not. any comments or ideas?


Thank you.
 
Tim Holloway
Bartender
Posts: 18417
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Wadha!

I'm assuming that this is RichFaces 3, since RichFaces 4 uses the JSF2 "ajax" tag instead of a4j. Just for information, you should be able to safely define "handleRequiredDaysChange" as private, since it apparently is not invoked by JSF or extra-class code.

You didn't state whether your diagnostic messages are displaying. Presumably they are and as I understand it, it's the re-rendering that's your problem.

Re-rendering can be tricky. Often if you cannot get a component to re-render after an AJAX request you can resolve the problem by re-rendering the target component's parent. In some cases, there's a non-obvious lack of connection between the AJAX control and the target area(s) that can be resolved by referencing a more explicit ID path. In other cases, such as elements in a table, the lower-level element cannot be re-rendered because doing so would imply re-rendering of the control(s) containing it.

 
wadha alketbi
Ranch Hand
Posts: 56
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Welcome to the JavaRanch, Wadha!

I'm assuming that this is RichFaces 3, since RichFaces 4 uses the JSF2 "ajax" tag instead of a4j. Just for information, you should be able to safely define "handleRequiredDaysChange" as private, since it apparently is not invoked by JSF or extra-class code.

You didn't state whether your diagnostic messages are displaying. Presumably they are and as I understand it, it's the re-rendering that's your problem.

Re-rendering can be tricky. Often if you cannot get a component to re-render after an AJAX request you can resolve the problem by re-rendering the target component's parent. In some cases, there's a non-obvious lack of connection between the AJAX control and the target area(s) that can be resolved by referencing a more explicit ID path. In other cases, such as elements in a table, the lower-level element cannot be re-rendered because doing so would imply re-rendering of the control(s) containing it.




It dose not display the result in the inputText when I select any date from the calendar. Also, if you see my code there is requiredDaysEnable = true after the calculation but it is still disable and there is no partial update in the page.

Can you please explain what you mean by (you can resolve the problem by re-rendering the target component's parent)?

Thank you.
 
wadha alketbi
Ranch Hand
Posts: 56
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read a lot about Re-rendering Partial Page Content but it dose not work with me there is no updating in the page and also the timeInDaysField that I want it to displayed "enabled" dose not show

please, any comment that may will help me.
 
Tim Holloway
Bartender
Posts: 18417
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"disabled" refers to whether an input control will allow user input or not. If you want to control whether the control is visible or not, use the "rendered=" attribute.

Rendering a parent means simply selecting the ID of an outer element instead of the inner element. For example, you can reRender "myForm" if that's the ID of the form that contains your calendar controls.

I am assuming that you have them in a form. Otherwise a lot of things won't work.
 
wadha alketbi
Ranch Hand
Posts: 56
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:"disabled" refers to whether an input control will allow user input or not. If you want to control whether the control is visible or not, use the "rendered=" attribute.

Rendering a parent means simply selecting the ID of an outer element instead of the inner element. For example, you can reRender "myForm" if that's the ID of the form that contains your calendar controls.

I am assuming that you have them in a form. Otherwise a lot of things won't work.


Thank you for your help, I appreciate that.
so, I will change the inputText to outputText because it will display the result of the calculation only or I can use inputText as it is now?
you know I use the support tag with the event= onchanged and reRender= the id of the outputText but there is no result of the rendering this component.
Also, what about the submission or process these components without the others components( I mean only run these 3 components) after that I will do save so, all the others will processed.

I read about partial update of the page but till now I did not get the right way :(

About the Rendering a parent actually, all of them in the same form but each of them in different panel and different table.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!