Jan 16th, 2010, 07:49 AM
How to implement a controller for an included page?
In the Spring Roo project, there is an included page "/WEB-INF/views/menu.jspx" which defined in layouts.xml:
<definition name="default" template="/WEB-INF/layouts/default.jspx">
<put-attribute name="menu" value="/WEB-INF/views/menu.jspx" />
It is an static HTML, but now I would like to do some programming work before this page shown.
I know a controller define with "@Controller" and "@RequestMapping("/xx")" for page URL.
But, how can I implement a controller for an included page without explicit URL?
Jan 18th, 2010, 05:19 PM
This is a quite unusual question. Can you please elaborate a little more on what you are actually trying to do? Most probably we can suggest a different solution than having a controller for your menu.
Jan 22nd, 2010, 12:22 AM
Originally Posted by Stefan Schmidt
My project is a content management system. In the published web site, almost all page including a common menu, which contain channels links.
These channels are dynamically load from database and can be defined dynamically.
So, I designed an embeded page call "menu.jspx" shared for all pages.
And if a controller or anything like that just for it, we can clearly separate the logic from other.
Is there any advice?
Jan 22nd, 2010, 02:04 AM
Personally I would consider using Spring Security for this purpose. You could then display menu items based on the user or role who is logged in. Spring Security 3 offers convenient @PreFilter or @PostFilterin conjunction with the new expression language support which would be of use for your application. Please refer to the Spring security docs for details. I have also written a blog post a while back on a related subject.