• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Ajax call, backing bean and validation

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all, here I'm again!

After running around and crawling the web, I have my main issue back again on my desk.
Please, help me to undertand if there is a solution to my ancient problem.

The scenario in quite simple:

- jsf 1.2
- richfaces
- ajax

Two required input text, rollo and job1.
An a4j:commandButton that updates the value oh the backing bean property linked to rollo input text.

It works fine: the button updates the backing bean and the input text on the page shows the updated value.
BUT when I submit the form and I trigger a validation error of a component JOB1 on the, the a4j:commandButton updates only the backing bean and not the field on the page. Indeed, if the component with validation problem is the one designed to be updated by the ajax call, IT WORKS. But if ANY other component is invalid, the ajax button can update only the backing bean and not the component. Maybe after the submit something happens that block the update. Losing my head, sorry.

is there a logic reason for that behaviour? Is there a workaround?

Many thanks!
Saloon Keeper
Posts: 25628
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSF does not permit partial updating of a bean where only valid items update. If any item selected for update is invalid, the backing bean will not be updated.

Normally, that means all property references on the submitted form. When using AJAX (a4j), you can limit the properties that are submitted/validated if you desire. However, you have not done this, so all properties will be submitted and subjected to validation.

When a backing bean property is updated using a4j, its value will only update on the View if the id of the control that displays its value has been included in a reRender request.
    Bookmark Topic Watch Topic
  • New Topic