Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I need help with ajaxSingle, reRender and immediate.

 
Fernando Soto Martorell
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I need help with this pages, I had proved with several combinations but i can't get make to work as desired.

I have a page in Web-Content/admin/unidad/default.xhtml:



the content of /admin/unidad/list.xhtml:



the action of the btInsert buttom navigate to /admin/unidad/admin.xhtml:



the content of /admin/templates/admin.xhtml:



This is the situation:

When I'm in the list(/admin/unidad/list/xhtml) and select an item of the "cmbEmpresa" selectOneMenu, the"cmbUnidad" and "cmbCentroCosto" selectOneMenus are rerendered with the new list of SelectItems, thaks ok, but when I click in the "btInsert", the grid is rerendered with filtered values, and when I click it again (the btInsert commandButtom) is when navigate to /admin//unidad/admin.xhtml. The navigation rule have not the redirect directive thus i always see http://localhost:8080/webrctel/admin/unidad/default.html.

Something similar in the /admin/unidad/admin.xhtml page, when the "cmbEmpresa" selectOneMenu changes, the"cmbUnidad" and "cmbCentroCosto" selectOneMenus are rerendered with the new list of SelectItems, but if the "btBack" is clicked, again the same problem, first rerender the seleconemenus ignoring the immediate=true and then, in the second click navigate.

How I can Solve this problem and make them work correctly?

The app is running in Tomcat 6.20, with JSF 1.2_07-b03-FCS.

Thanks in advance.>
 
Max Katz
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should post a simpler example.. to much code.

reRender - points to component id's you want to render (after an Ajax request).

For example:
reRender="id"
or
reRender="id1, id2, id3"
or
reRender="#{bean.renderComponents}"

ajaxSingle - processes only the current component when you fire an Ajax request. No other components on the page will be processed (go thru the life cycle). This article will help you more with ajaxSingle: http://mkblog.exadel.com/ria/richfaces-region-partial-jsf-tree-processing/

immediate - for input components, will execute Process Validations phase for this component during Apply Request Values phase. For action components, will execute Invoke Application phase during Apply Request Values phase.

Hope this helps...

Max
http://mkblog.exadel.com
 
Fernando Soto Martorell
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well. sorry for the bunch of code, i've posted all the code in case the error is in other component.

I'll explain the problen with minimal code...

In a page are severals selectOneMenu, wich are used to filter a data in a rich:dataTable.
When the first (selectOneMenu) is changed, the others selectOneMenu must be rerendered with new data filtred by the first selectOneMenu, but cant rerender the dataTable. That works fine.
When the first selectOneMenu is unchanged, the commandButton do the navigation, but if the selectOneMenu is changed, the commandButton in the first click rerenders the dataTable, and in the second click, is when navigate.
What I whant is when the button is clicked, go ahead with the navigation rather than rerender the grid.
 
Max Katz
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a4j:commandButton shouldn't be used for navigation, it fires an Ajax request and does a partial page update. To force a4j:commandButton to navigate you need to set <redirect/> in navigation rules. It's better to use standard h:commandButton for navigation.

Max
http://mkblog.exadel.com
 
Nirmalya Basu
Greenhorn
Posts: 1
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, see the problem you are facing is that when you click for the first time on the button to navigate, then what happens is the current page gets loaded first , so you do not go to the desired navigation page. On the second click as the page is already loaded then you can go to the desired navigation page.

Solution : The list and menu list where you facing such problem, there in the reRender property add the current page Form ID , so everytime you use the list/menulist the page gets loaded so when the button pressed for the first time you will navigate to the desired page


Hope this helps.

Cheers,
Rahul Basu
 
srilakshmi madala
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you wrote valuechange listner in backinbean for changing the value when ever you select value from selectonemenu.?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic