javahtmlembedguicesitebricks

embed header and footer in all html page using google sitebricks @embed


I am building an Admin dashboard with google guice and sitebricks .Can you please tell me how to include other html files in a html page ? I am looking for a function similar to php's include("header.html") function . I see that sitebricks has an @embed annotation but couldnt find much help about it

Thanks in advance


Solution

  • You have different possibilities.

    Use embed

    The @Embed annotation allows you to declare pages fragment that can be embed into other pages.

    You'll find a full example here : http://code.google.com/p/google-sitebricks/wiki/EmbeddingBricks

    Use decoration

    The other approach is to decalre a generic page with your header and footer and use the @Decorated annotation on the container div of your page.

    Then you have to declare all pages as @Decorated and extends the generic page.

    Please find more documentation in sitebricks google group : https://groups.google.com/forum/#!searchin/google-sitebricks/decorated/google-sitebricks/CUOJM-CP9hM/ENe930RAuZwJ