I want to create a master template that will be the heir to every other watch page.
Then the master template will be:
header --CONTENT-- fotter -
The title is optional Will show (if user is logged in), user name and other user object property
-
--CONTENT-- is a placeholder that will inject your content into other 'Inheriting' watch pages.
So my questions are, is it possible with freemarker? If so, any guidance?
How do I pass user object to headers from my controller function? Ideally the object will be passed in any place other than each and every page of the page (each code to avoid keeping this code).
Yes, this is possible. There are things like user objects in session objects in our applications, but this can be accessed by any freer freer:
& lt; #if Session.the_user ?? & Amp; & Amp; Session.the_user.loggedIn & gt; & Lt; # - Header code - & gt; & Lt; / # If & gt; You can cancel the session. and the freemakers will search different types of given variable names.
To inject content, it is at the point in the master template where you want the view page to contain its contents:
The watch page then declares their use of the master template as follows:
& lt; #import "/ WEB-INF / ftl / path / to /template/master.ftl" com & gt; & Lt; @ Com.template & gt; View page content & lt; / @ Com.template & gt;
Comments
Post a Comment