File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Ajax render outside of form problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Ajax render outside of form problem " Watch "Ajax render outside of form problem " New topic

Ajax render outside of form problem

Robe Eleckers

Joined: Jul 08, 2009
Posts: 9

I have a problem with Ajax partial rendering. My (simplified) situation is as follows:

Flow (how I want it):
1. <cu:menu> component renders an html link like: <a href="#" onclick="mojarra.ab('j_idt9:j_idt10',event,'click',0,'content',null)">Click</a>
2. Clicking on this link should first call the ajax listener #{myListener.update}. This listeners changes the value of '#{myBean.value}'.
3. Now the component with id 'content' should be re-rendered and show the updated value of '#{myBean.value}'

However, in reality step 2 and 3 are switched, so first the rendering is done, then the listener is called. So only after the second click I see a content change.

Any ideas how to handle this?

I had a feeling this behavior is because I try to render something outside my ajaxified form. So I added the same outputText tag inside my form and render that at the same time as my outputtext outside the form.

Now I see the following sequence when clicking a link generated by the cu:menu component:
1. Component with id 'content' is rendered (outside the form).
2. #{myListener.update} is called, this changes the value of myBean.value.
3. Component with id 'test' is rendered (inside the form).

This causes the component outside of the form to be re-rendered without the value being changed first. Any ideas on how to change this?


I agree. Here's the link:
subject: Ajax render outside of form problem
It's not a secret anymore!