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
  • 27,144
  • 16
  • 62
  • 82
nabiullinas
  • 1,185
  • 4
  • 20
  • 41

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
  • 7,117
  • 6
  • 38
  • 62
  • 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