Skip to main content

A Multi-templating System in JSF 2.2 : what does it mean for you?

Posted by lamine_ba on November 12, 2011 at 2:25 PM PST

 

For prosperity to be sustained it must be shared.
thegatesnotes

Introduction

Ladies and Gentlemen, today, while I'm writing this blog post, I'm one-eyed. Last saturday, I woke up earlier in the morning and I noticed that I couldn't see out with my right eye. I went to see an ophtalmologist to find the cause and the solution and now I'm taking drugs. I'm sharing this crazy experience with you only because it has teached me something. That life is all about having the right vision and you can do that only if you are in the right perspective to see the things right.

Now let's come back to the subject of my blog post, a Multi-templating system in JSF 2.2 : what does it mean for you?  But before answering this question, could I have an insight of your perspective? Who are you in regard to the JSF audience? a Page Author, a Component Writer, an Application Developer, a Tool Provider or a JSF Implementor? If your role belongs to any of these categories, it is fair to call you a "Web Developer". And myself I can fairly say that you are not the primary target of this feature. We have built this Multi-templating system inspired by Joomla's, the most popular CMS in the PHP world, to correct a mistake that Java EE and its web frameworks are doing ever since.

 

Why did they put the web designers aside? Why Java EE has the ugliest user interfaces I have ever seen ? Why most of the web sites are Php-based ? Truly, in the web and in term of audience, a weak language is kicking the ass of a Platform. Woow! that is really amazing! A real remake of David and Goliath. And as a confirmation, I'm going to share with you a little part of the discussion I had yersterday with Akintayo Abiona Olusegun, a nigerian developer who has converted his PHP application into a JSF one. I asked him why he did that and also if I could have an insight of the state of art in the area of web development in his country. And below are his answers.

 


 

"I did decide to use JSF not because I have any particular problems with PHP, No. The website needs a facelift and since I have just studied JSF and all the goodness, I decided to use JSF. Primefaces is also one of the things that help my decision. Most of the things I have to write css and/or javascript (or look for plugins upon plugins for jquery) are made very easy using primefaces. Java EE 6 was the icing on the cake. It is really now very easy to do a Java EE APP compared to say 5 years ago......"

 

"Here in Nigeria, the predominant web design language is still PHP though. A few people use java for web really, Most people just either use PHP or ASP.NET. The reason is because hosting a Java APP is still very expensive and most of the independent Java developers I know can't afford it. But Java is still the most popular programming language, ALL the companies I know use Java somehow. The biggest companies here (telecoms, oil and gas and banking) are all using Java and Oracle tools, so to get a Job in these companies, Java knowledge is a MUST. But a very high percentage of the freelancers I know use PHP for web..."

 


But soon such will not be the case because a metamorphosis is happening and we were clever enough to include the web designers in the audience of the upcoming 2.2 version of JSF. And depending on the perspective you are, it means these things for you : Like for Joomla and PHP, JSF and the Java EE world are moving towards a worldwide collaborative development. A JSF developer will no longer create the user interface of his web application, he will just download a template made a template author from all over the world. And you can be sure that it will happen because it is much easier now to design a JSF template than a Joomla template. No knowledge of JSF and Java is required. Only a knowledge of html, css, javascript, photoshop and such. And you can be sure that soon we will have all these templates available to us : Joomla Templates . Very cool, no?

Let's meet in the Cloud

Let's come now to the other part of the problem and here is how I will start. Am I the only one who has the vision that once we have released an implementation of JSF 2.2 and its Multi-Templating system, these two questions will arise :

  • From a developer perspective : Where can I find templates?
  • From a template author perspective : Where can I publish free and commercial templates to make my own business?

Don't you see that if we do nothing, we will end up by having like for Joomla this awful distributed model : "Do it yourself. Build your own solution and host it on your own infrastructure and don't forget to reference your web site if you want the developers to find your templates through a Google search." So can you understand our desire to make things simple by building a service in the Cloud to connect these two entities into a central place :

  • so that a web developer can find templates easily without searching the whole web
  • so that a professional web design individual or company will not build and host a solution he cannot afford.

And to have this dream fullfilled, we are planning to collaborate with a Cloud provider so that we can push JSF and Java EE to the next level. So be ready to meet us soon in the Cloud....

JSF 2.2 : The Movie [ Coming Soon ]

Following our desire to innovate, JSF 2.2 will be the first JSR to have a video presentation. It will be made available after the Final Draft but below are some screenshots.I definitely recommend you to do the same for your project. You can use After Effects for that. Professionnal video designers are using this tool for most of the animations and the movies you are watching on TV. If you want to learn more about it and to have an insight of the video design universe, I suggest you to follow the tutorials of Andrew Kramer on his videocopilot.net web site. Definitely worth giving it a look, this guy is truly awesome....

 

 

Conclusion

Ladies and Gentlemen, everything has been said and done so I will not waste your time anymore. Let's just meet here next time for another blog post. So until then, I'm going to take my drugs. Hope I will recover soon my whole vision...

AttachmentSize
video5.PNG457.64 KB
video6.PNG246.65 KB
video1.PNG456.16 KB
video4.PNG476.11 KB
video2.PNG454.58 KB
video3.PNG371.68 KB
Related Topics >>

Comments

Hi bro, hope my message find you in good heath that allow ...

Hi bro, hope my message find you in good heath that allow you to continue to solve a big problem in JavaEE. This blog has very nicely explained. JSF2.2+PrimeFaces will biggy improve the development web in JavaEE platform. I still believed JSF and i continue to believe it, because it will be the solution.
Regards!!

Hi papesdiop Thank you very much for your nice comment and ...

Hi papesdiop

Thank you very much for your nice comment and I appreciate your prayer. Yes, continue to believe in Java EE and JSF. Having a bad start in the starting-block does not mean you cannot be the winner of the race. The JSF community, you included, is currently doing an amazing work. But more are coming. Hope to read you soon.

Regards
Lamine

Good day,  This is a really awesome idea and it has my ...

Good day,

This is a really awesome idea and it has my vote to be included in the JSF spec. I wonder if it would be possible to have the templates externalized from the actual WAR file which has a number of advantages.

Regards,

Mark P Ashworth (http://mpashworth.wordpress.com)

Hello Mark, First of all, thank you very much for your vote ...

Hello Mark,

First of all, thank you very much for your vote and for your clever comment. Yes, having the templates externalized from the actual WAR file has a number of advantages and that is a part of a topic I have called : " The deployment scenarios ". When I have built the prototype of this Multi-templating system, I have covered and solved this problem at last. I was waiting just for people to understand the idea and I'm really glad they did it. Let's me share with you now the different deployment scenarios available to us so that you can choose the right one depending on your needs.

  1. First scenario : you have stored your templates in a directory in the war file. Can we call this : " the evident and non-efficient way ". With this model, how one can share his templates among his JSF applications?  Surely with a copy and paste? The use of this model will lead to a lot of duplication. And when a developer downloads his templates from the web on his computer, he stores them already in an external directory. So why can't he just reference in the web.xml the location of this directory to have the templates loaded by any of his JSF applications? That is one solution but it means these things for you : you are working alone and your applications are running in a local mode. And when you deploy your JSF application in a remote web server and the templates are still in your local external directory, you must also upload this directory and make the right change (location) in the web.xml. But at least, using this solution, you have a central place and any of your JSF applications hosted on this remote web server can share your templates. Thus you have no resources duplication.To finish, when you are collaborating with a team using this solution in the development of a JSF application, my suggestion is to create first a svn or a git repository for only the storage of templates.
  2. Second Scenario : Here is another cool way to externalize your templates. Did you know that you can use my own templates without having them installed on your computer? How I did that? I have a template service built with JAX-RS available worldwide. You can see it in action in my prototype. My JSF applications are using these templates remotely because each template has an url  and I can reference one of them in my web.xml. And after that, I let the two entities (JSF and JAX-RS) to talk and make my will. And with this solution I can build another template clients like an android client to view my templates on my phone. cool, no?

JSF and JAX-RS playing seamlessly

 If you find another deployment scenario, It would be nice if you can share it to us. I have also the project of an administration console so that you can manage easily your templates and set the default one at runtime without the use of the the web.xml file so that you can avoid a restart of your application and a waste of your precious time. At last, I think that you will be the guest star of one of my next blog posts because many people will not read your clever comment and my reply. Thank you again Mark

Regards
Lamine

 I concur. Having the template outside the war file ...

I concur.

Having the template outside the war file means you can change the LAF of your page without having to recompile the whole app. This would be very advantageous. I think this would be also be easy if one can link to the template using say href. Right now what I do is host my images and css file in apache, so that I can change the images and css files easily to change the LAF of my web page without having to recompile/re-deploy.

Thanks Lamine.

Hi trinisoftinc, Thank you very much for your nice comment. ...

Hi trinisoftinc,

Thank you very much for your nice comment. Yes, Having the template outside the war file means you can change the LAF of your page without having to recompile the whole app and this would be very advantageous. And you can be sure that you will have it. Please read my reply to Mark or wait for my next blog post. Regarding your statement "I think this would be also be easy if one can link to the template using say href", Let me reveal you that we have already this feature and it working pretty well on my prototype. We call it "Dynamic Template Selection". You can change the LAF of your application while navigating to another page of course if your add in the url the id of the template you want to use as a request parameter following this scheme : http://server/app/page.xhtml?template=id. Please see it in action in my prototype . Thanks

One page using dynamically three different templates

  1. http://jsfmtsystem.appspot.com/faces/templateDetails.xhtml?template=tbc_xen
  2. href="http://jsfmtsystem.appspot.com/faces/templateDetails.xhtml?template=pinkkitty
  3. http://jsfmtsystem.appspot.com/faces/templateDetails.xhtml?template=rockstar

Regards
Lamine

hi all .  i ask what it is El resolver into ...

hi all .

i ask what it is El resolver into JSF .

I study JSF self me and i not understand .

Tank you all.

naciu

Hi naciu45 I'm very glad to hear that you are learning JSF ...

Hi naciu45

I'm very glad to hear that you are learning JSF and I like very much your approach. When you want to have a clear understanding of something, you must always try to understand first its concepts. Google can be your best friend in your learning process, just type what you are looking for in the input text or you can consider to buy a recent JSF book covering the 2.0 version of JSF. I recommend you "JSF 2.0 the complete reference" from Ed Burns. But here are some links I have found in the web. Try first to understand what is an Expression Language (EL) and after it will be very easy for you to understand what is an EL Resolver. These concepts were first introduced in JSP. 

Thanks
Lamine