we have a Tiles layout page having Header, Menu, Body and Footer. In this layout whenever user does some action in the Menu lists, the whole Layout (Incl Header, menu and footer
I did like the Th0rndike and work like a charm. I am using the spring and was a little different, but with the same idea.
In my configuration, using tiles to solve using only the views, I could not do the forward of the new body using the jsp file directly, for example, using path = "/pathToJsp/content1.jsp".
Using the default configuration of the spring documentation for your tiles in file layouts.xml add beyond the existing template, the new template which will be responsible for containing the new body each time the Ajax request is made.
Definition>
Set the template file as:
In file views.xml set the content for each link that load the new body of your page in particular:
Definition>
Definition>
The Ajax request can be made in the main template:
$ (Document). ready (function () {
$ ('. PageAction'). click (function (e) {
LoadPage (e)
});
function LoadPage (e) {
e.preventDefault ();
console.log (e)
console.log (e.currentTarget.pathname);
$ ('# BodySwitcher'). children (). remove ();
$ ('# BodySwitcher'.) Load ("bodySwitcher? Method =" + e.currentTarget.pathname);
}
});
The ajax request can be handled using the controller that forward to view specified in the parameter method of bodySwitcher. Return the forward string like "forward:" + link1 to forward to controller that handle link1 requests;