• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to call set of validations(non screen field) from with in the JSF life cycle

 
Ranch Hand
Posts: 121
Mac Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I have an issue of how to call business rule validations which are already defined in some POJO classes after completing the screen field validations
so that if any errors in business rules then I no need to set the backing bean values instead same page will be displayed with whole bunch of errors.
with this approach it is guaranteed that update model values phase will be executed only when there are no errors (both business and screen field).

any help is appreciated.
 
Saloon Keeper
Posts: 27807
196
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
The Backing Bean is a Model, but it shouldn't be considered the Business Model. It's the View Model. JSF will automatically update the Backing Bean if the GUI validations all pass, and there's no simple way to interfere with that process. Therefore, in cases like this, where you want business validation in addition to view validation, you should use the backing bean as a facade object, instead of the primary object.

We've had several discussions here about why in particular, it's not advisable to use Domain Model objects directly as backing beans.

Incidentally, if your backing bean does strongly resemble a deeper-layer object such as a Domain Model object, you might find the "dozer" data mover framework useful. The two types of objects need not be 100% identical. Dozer is available from sourceforce.net, and for people doing Maven builds, it's also available as a Maven Repository resource.
 
Whose rules are you playing by? This tiny ad doesn't respect those rules:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic