0

I need to create a user interface where the content changes every time the user moves to a new page. However, the header and footer remains the same.

But, within the content, there is sometimes a left pane visible on some of the pages. I'm not sure how can this be achieved since I'm new to using JSF.

Can someone please suggest a way?

Thanks!

n_g
  • 3,315
  • 8
  • 25
  • 29
  • Use JSF Templating, And create different templates and then use appropriate one for corresponding page – Jitesh May 17 '13 at 12:25

2 Answers2

1

You can achieve this by creating 2 different layouts and using for the correct layout

  • one with left rail
  • another without left rail

You need to look at JSF template with Facelets

Here are some links that you can refer

NullPointerException
  • 3,732
  • 5
  • 28
  • 62
0

For the 'puzzly' composition of pages you need to use templating. Great overview can be found in the answer to How to include another XHTML in XHTML using JSF 2.0 Facelets?. The layout itself is HTML/CSS-related, so you need to check that out first.

If you want to produce one part of a template conditionally, there are two possibilities: to do that from a master template, or to do it from a template client. Of course, you could create many templates, as others recommend, but this is counterproductive and hard to maintain in my opinion.

If you want to render a part of template conditionally, you can include rendered="#{view.viewId = '...'}" attribute to JSF components in master template.

Alternatively, if you want to 'overwrite' the default part of a template, that for example has a left panel, just define the target area as an empty one in a template client like <ui:define name="left" />.

Community
  • 1
  • 1
skuntsel
  • 11,624
  • 11
  • 44
  • 67