jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] JS implementation of JSF

From: Cagatay Civici <cagatay.civici_at_gmail.com>
Date: Thu, 19 Mar 2015 22:49:37 +0200

Hi,

Mostly for fun, I’m working on a crazy but interesting concept that implements the core idea of JSF on client side. Main parts of JSF like beans, components, el and lifecycle are all javascript objects.

I’ve done a proof of concept implementation today as well, jsfiddle is at;

http://jsfiddle.net/cagataycivici/r7gxsmy7/

Basically view part (counterpart of JSF xhtml view) is;

<body>

<div id="main" class="container”>
    <p-inputtext value="#{testModel.person.name}" class="form-control" placeholder="Enter name"></p-inputtext>

<p-button value="Click Me" process="main" listener="#{testModel.handleClick}" class="btn btn-default"></p-button>

<p-outputtext value="#{testModel.person.name}"></p-outputtext>
</div>

</body>

and the model part (counterpart of JSF managed bean);

PrimeJS.model({name:'testModel'}, Class.extend({

init: function() {
this.person = {
name: null
};
},

handleClick: function() {
alert('Hello ' + this.person.name);
}
})
);


I’m not sure if I’ll pursue this, as I’ve mentioned it is a proof of concept for fun but I’d really like to hear your opinions.

Regards,

Cagatay Civici
PrimeFaces Lead
PrimeTek Informatics
www.primefaces.org