Invoking Hibernate Validator from JavaFX

I showed how to call a Seam component with Flamingo from JavaFX. In this post I show how to invoke Hibernate Validator from JavaFX with Flamingo:

Entity (and Seam component):

@Name ("icecream")
public class IceCream {

   @Id @GeneratedValue
   private Long id;

   @Max(value=5, message="Sorry, you can't have more than {value} flavors")
   private Integer flavors;

   // getters and setters

JavaFX script (most interesting stuff is happening lines 17-21):

FXServiceFactory.URL = "http://localhost:8080/server-javafx/seam/resource/hessian/";

var message:String;
var textBox:TextBox = TextBox {
    columns: 15
var label:Label = Label {
    text : "How many flavors:"
var errorMessage:Label = Label {
    text: bind message
    style : "-fx-text-fill:red; -fx-font-weight:bold"
var button:Button = Button {
    text: "Click"
    action : function () {
       var ev = FXServiceFactory.getService(EntityValidator.class,
       		as (EntityValidator);
       message = ev.validate ("icecream.flavors", textBox.text)

Stage {
    title: "Application"
    width: 250 height: 100
    scene: Scene {
        content: [
        VBox {
            spacing: 5
            HBox {
                spacing: 5
                content: [


That’s it.

Published by

One response to “Invoking Hibernate Validator from JavaFX”

  1. […] Seam component from JavaFX Invoking Hibernate Validator from JavaFX Binding to server-side context variable from JavaFX Using Expression Language (EL) in JavaFX to […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.