Announcement Announcement Module
Collapse
No announcement yet.
How to implement a controller for an included page? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to implement a controller for an included page?

    Hi All,

    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" />
    </definition>

    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?

    thanks advance!

  • #2
    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.

    Comment


    • #3
      Originally posted by Stefan Schmidt View Post
      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.
      Well.

      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?

      Comment


      • #4
        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.

        HTH

        Comment

        Working...
        X