1

I want to create an Spring MVC application, but I all tutorials and examples that I saw, there are one view for one controller action. But, can I make something like template.jsp with content and view components, with it's own minilogic and include in view tamplate.

Example template.jsp:

<html>
  <head>
  ......
  </head>
  <body>
    <div id="menu">
      #menuComponent
    </div>
    <content>
      #content from action
    </content>
  </body>
</html>
jh314
  • 25,902
  • 15
  • 60
  • 80
nabiullinas
  • 1,115
  • 3
  • 19
  • 40

1 Answers1

1

Yes, you can. Spring understands the importance of creating components as separate module. To do efficient layout Spring has Tiles. You can take a tutorial over here

Raunak Agarwal
  • 6,957
  • 6
  • 36
  • 61
  • Does Tiles can pass parametrs to import views. For example in play, I can import it with params @header(message). – nabiullinas Aug 04 '13 at 09:47
  • Not exactly, but in tiles you can create multiple templates i.e. a generic definition of header, footer, menu, content etc. And you can load each component properties dynamically – Raunak Agarwal Aug 04 '13 at 10:12