views:

473

answers:

2

Hi, I'm trying to achieve the layout shown here alt text

Each of the panels should be linked to a backing bean from which I will later add differrent components according to context.

I tried using panelgrid but could not achieve this look. I would prefer to use just JSF for this but if impossible or too complicated RichFaces is ok too.

Thanks!!

+1  A: 

You can use the HTML code with which you have achieved the above layout. I.e.

<table>
   <tr>..</tr>
   <tr>..</tr>
</table>

However, the table-less layouts are preferred - i.e. using <div> tags. (see here)

Bozho
Thanks, I didn't get the div+panelgroup solution.Can you give a minimal example or direct me to a link with one?
Ben
it is a matter of HTML+CSS, not JSF. For simple layouts don't use JSF at all. If there are conditional parts of the layout - i.e. a sidebar that appears sometimes, then that's another question. But your layout looks simple, so go with pure HTML+CSS
Bozho
ok got it. Thanks.One more questions - Why is the table-less layout preferred?
Ben
http://www.smashingmagazine.com/2009/04/08/from-table-hell-to-div-hell/
Bozho
Thank you! great link! (should have probably googled it :-) )
Ben
A: 

It's not only matter of JSF/HTML, but it's also a matter of CSS. The above layout can basically already be achieved as follows:

<h:panelGroup id="header" layout="block"></h:panelGroup>
<h:panelGroup id="leftcol" layout="block"></h:panelGroup>
<h:panelGroup id="rightcol" layout="block"></h:panelGroup>

(which generates the following HTML)

<div id="header"></div>
<div id="leftcol"></div>
<div id="rightcol"></div>   

You can style/position it using CSS like as:

#header {
    width: 100%;
    height: 100px;
}
#leftcol {
    width: 200px;
    float: left;
}
#rightcol {
    float: left;
}

That's all.

BalusC
Thank you! I've been searching for this example on the net and this is the simplest clearest example I could find.
Ben
You're welcome. There however comes more into picture when you want to go a bit further than three separate blank sections. E.g. backgound colors, borders and so on. But this should at least get you started :)
BalusC