Added Java Expression Language examples integrated on ItsNat in ItsNat Experiments

47 views
Skip to first unread message

Jose Maria Arranz Santamaria

unread,
Aug 2, 2013, 6:10:02 PM8/2/13
to

ItsNat promotes a clean and radical separation of UI and view logic, anyway many people are used to Java Expression Language mixing both things (that is code in markup).

Yes you can do something similar with ItsNat if you want with a little effort .

I've published some examples of using Java Expression Language in ItsNat templates and some code examples of how you can make generic wrappers to ItsNat components and utilities using EL.

For instance:

    <ul id="personListUL" itsnat:nocache="true"> 
    <li><b>${person.name}</b> ${person.age} ${person.unitAge()}</li>
    </ul> 

Even setting a Java bean property with user provided data using a input type=text element and text component with this markup:

<input id="personNameId" type="text" size="50" value="#{person.name}" />

Main Java File (document): 


See online 


Enjoy

Ravindranath Akila

unread,
Aug 2, 2013, 10:36:02 PM8/2/13
to Jose María Arranz Santamaría, its...@googlegroups.com

Best of both worlds! This brings back my memories on JSP. Sometimes it is fun embedding objects and logic in UI. Gives you the feeling of being in full control. This feature is ideal to do a quick mock up of an idea (POC), and that's commonplace these days. It also shows how capable ItsNat is.

R. A.
BTW, there is a website called Thank God it's Friday!
It tells you fun things to do in your area over the weekend. 
See here: http://www.ThankGodItIsFriday.com

On 3 Aug 2013 05:59, "Jose Maria Arranz Santamaria" <jmar...@innowhere.com> wrote:

ItsNat promotes a clean and radical separation of UI and view logic, anyway many people are used to Java Expression Language mixing both things (that is code in markup).

Yes you can do something similar with ItsNat if you want with a little effort .

I've published some examples of using Java Expression Language in ItsNat templates and some code examples of how you can make generic wrappers to ItsNat components and utilities using EL.

For instance:

    <ul id="personListUL" itsnat:nocache="true"> 
    <li><b>${person.name}</b> ${person.age} ${person.unitAge()}</li>
    </ul> 

Even setting a Java bean property with user provided data using a input type=text element and text component with this markup:

<input id="personNameId" type="text" size="50" value="#{person.name}" />


--
You received this message because you are subscribed to the Google Groups "itsnat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to itsnat+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jose Maria Arranz Santamaria

unread,
Aug 3, 2013, 4:18:19 AM8/3/13
to its...@googlegroups.com, Jose María Arranz Santamaría
Beyond JSP, EL is a key part of JavaEE heavily used in JSF.

Most of  frameworks, server centric or client centric, use this kind of approach of mixing UI and view logic and data models, for instance many use OGNL, OGNL is more of the same, some modern JavaScript frameworks use similar expression systems for templating and in case of Google Closure expression lang is the same for client (JS) and server (Java) as far as I know.

I don't like very much this approach, I prefer pluggable "renderers" because with some effort you can reuse these renderers for any type of "person list" in your project, the alternative is repeating the same expressions again and again polluting templates with code (not very much happiness for web designers) and I'm obsessed with reusing. Anyway as explained before, expressions in markup are SO popular that I was very interested to show you can code this "dirty" stuff also in ItsNat, of course optionally. 

Regards
Reply all
Reply to author
Forward
0 new messages