• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF Doubts

 
guru prasanth
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSF can i write a cusomt validator for validating the business rules.Similarly i need to convert the ui components into
an xml or in to a java object.Can i use a custom convertors.Or should i use backing bean for both validation and conversion.
I know i can use both but which is better according to JSF Best practise.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
None of the above.

Validators and Converters are used by the JSF Controllers as extensions to the Controller function. They shouldn't be handling business rules or conversions other that JSF-internal to/from HTML (text) form. The purpose of a Controller is to represent changes made to a Model in its corresponding View and to reflect changes made to the controls in the View back into the model.

Generally, the process of doing advanced business rule processing and conversion to/from data formats other than those directly addressed by the JSF MVC subsystem is something you handle in an Action method (or AJAX listener).
 
Bharath Kannan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tim,

Can you please help me understand why the ManagedBeans are implementing Serializable?
There are arguments about the bean objects being used over network RMI/RPC, but im not really convinced.

Can you please help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic