Saturday, November 27, 2010

Dynamic JSF 2.0 Page

I have had a number of folks ask about templates and JSF. There seems to be a misconception that you need a template for all of your content, and that the content can not be dynamically generated for a page. This is not true! I am not sure where this comes from, but it is not uncommon question.

Dynamic JSF Page

The example NetBeans project in the link below, demonstrates how to to use the binding attribute to inject the required information into a page before rendering it. I have added the binding attribute to the <body> tag. This allows me to modify the content of the page body before it is rendered.

I have also included how to use the ValueExpression to set the value of the rendered text. This example should be sufficient to demonstrate the capabilities.

The project code is a NetBeans project:


Oren Bochman said...

It would be better if you posted the info on your blog instead of just using a netbeans project.

That way users who don't use that ide can use it too.

John Yeary said...

I use NetBeans! If you use another IDE like Eclipse, you can import the project. NetBeans uses Apache Ant so you can use it directly by calling ant from the command line.

The code is really what you are after anyway not the IDE.

Popular Posts