https://docs.oracle.com/javaee/7/javaserver-faces-2-2/vdldocs-facelets/toc.htm this is the Facelets documentation
and this https://docs.oracle.com/javaee/7/javaserver-faces-2-2/vdldocs-facelets/ui/composition.html is the ui:composition documentation
RANT ON
Let's admit it, HTML UI development is sheer mess.
In OOP you learn about nice encapsulation, separation of concerns, tidy APIs, design-time validation, convention over configuration... in HTML it's exactly the other way round, everything mixed up and it's just a verbose visually incomprehensible jungle, tons of implicit stuff has to be explicitly stated over and over, tons of useless boilerplate fluff make the code unreadable. It makes me really sick. With some better designed standard, the size of this crap could be reduced by a factor of 10 without any loss, actually gaining a lot in readability and maintainability. It's so evident.
RANT OFF
Here a decent tutorial (a bit too complicated) on templates:
code is here:
https://github.com/discospiff/JavaFullStackEnterpriseWeb
in a JSF application you use a template, in which you insert contents defined in pages.
In a template, to insert the content, you use div+insert (=insertContent) ,
In a page, to use a template, you use composition (=useTemplate)
In a page, to define the content, you use define (=defineContent).
Again: a template inserts stuff; a page defines stuff and uses a template to arrange it on a layout.
for a page, look here https://github.com/discospiff/JavaFullStackEnterpriseWeb/blob/master/PlantPlaces/WebContent/index.xhtml
and the corresponding template is https://github.com/discospiff/JavaFullStackEnterpriseWeb/blob/master/PlantPlaces/WebContent/template.xhtml
Saturday, December 2, 2017
Netbeans rocks, Eclipse sucks
With Eclipse, setting up a simple Web Application with JSF and deploying it to Wildfly is a long, frustrating struggle.
With Netbeans, it takes 10 seconds.
File / New Project, Java Web / Web Application, project name "WebApplication1", server : select Wildfly server, Java EE Version: Java EE 7 Web, context path: /WebApplication1, Frameworks: select JavaServer Faces, in the components tab select Primefaces (the first time iyou haveto wait 10 seconds while it fetches the dependencies "JSF library Primefaces not setup correctly..." )
Right click on the Project, Run... it will open http://localhost:8080/WebApplication1/ and you are ready to go.
What Netbeans generates is:
BEWARE: to run on Wildfly 11, you should change the version of primefaces in pom.xml from 5.0 to 6.0, otherwise you get an error "wildfly This page calls for XML namespace http://primefaces.org/ui declared with prefix p but no taglibrary exists for that namespace"
The only issue I had with Netbeans 8.2 is that it's not compatible with Java 9, I had to edit netbeans.conf and change netbeans_jdkhome to point to JDK 8.
Incidentally, check out this AWESOME video on how to generate a Primefaces crud application from Entities with Netbeans
https://netbeans.org/kb/docs/javaee/maven-primefaces-screencast.html
You can simply forget that with Eclipse. A Total Eclipse of the Heart
"every now and then I fall apart
I don't know what to do and I am always in the dark
There is nothing I can do, a total Eclipse of the heart
Once upon a time there was light in my life"
hahaha
With Netbeans, it takes 10 seconds.
File / New Project, Java Web / Web Application, project name "WebApplication1", server : select Wildfly server, Java EE Version: Java EE 7 Web, context path: /WebApplication1, Frameworks: select JavaServer Faces, in the components tab select Primefaces (the first time iyou haveto wait 10 seconds while it fetches the dependencies "JSF library Primefaces not setup correctly..." )
Right click on the Project, Run... it will open http://localhost:8080/WebApplication1/ and you are ready to go.
What Netbeans generates is:
BEWARE: to run on Wildfly 11, you should change the version of primefaces in pom.xml from 5.0 to 6.0, otherwise you get an error "wildfly This page calls for XML namespace http://primefaces.org/ui declared with prefix p but no taglibrary exists for that namespace"
The only issue I had with Netbeans 8.2 is that it's not compatible with Java 9, I had to edit netbeans.conf and change netbeans_jdkhome to point to JDK 8.
Incidentally, check out this AWESOME video on how to generate a Primefaces crud application from Entities with Netbeans
https://netbeans.org/kb/docs/javaee/maven-primefaces-screencast.html
You can simply forget that with Eclipse. A Total Eclipse of the Heart
"every now and then I fall apart
I don't know what to do and I am always in the dark
There is nothing I can do, a total Eclipse of the heart
Once upon a time there was light in my life"
hahaha
Labels:
eclipse,
jsf,
netbeans,
primefaces
Friday, December 1, 2017
Swiss-German resources
https://www.youtube.com/user/SRFDOK
http://www.eldrid.ch/swgerman.htm
https://www.e-erni.com/swiss-german.html https://www.e-erni.com/how-are-you.html
https://www.swiss-german-online.com/lessons.html
https://www.memrise.com/courses/english/swiss-german/
https://www.youtube.com/user/peachweber00 Peach Weber
https://www.youtube.com/user/Cheyenne16081973 Divertimento
https://www.youtube.com/watch?v=uol65_ThwjY Schmirinskis
https://de.wikipedia.org/wiki/Mani_Matter
https://de.wikipedia.org/wiki/Franz_Hohler
http://www.eldrid.ch/swgerman.htm
https://www.e-erni.com/swiss-german.html https://www.e-erni.com/how-are-you.html
https://www.swiss-german-online.com/lessons.html
https://www.memrise.com/courses/english/swiss-german/
https://www.youtube.com/user/peachweber00 Peach Weber
https://www.youtube.com/user/Cheyenne16081973 Divertimento
https://www.youtube.com/watch?v=uol65_ThwjY Schmirinskis
https://de.wikipedia.org/wiki/Mani_Matter
https://de.wikipedia.org/wiki/Franz_Hohler
Subscribe to:
Posts (Atom)