1

I am making a website with around 20 pages in it. Now almost all the pages have same general layout like the menu bar, header, footer etc. I've made a jsp page which contains this common contents and then with the help of 'include' tag I'm using it for the other pages. So is it advisable to follow this technique? Kindly inform me about the pros and cons of using this technique. Thanks in advance.

Saumil
  • 2,521
  • 5
  • 32
  • 54
  • Read this please http://stackoverflow.com/questions/7879906/what-is-the-difference-between-jspinclude-page-and-include-file – Anton Nov 02 '13 at 10:06
  • @Anton thanks buddy it helped, but can you tell me as both the files will have their own 'head' and 'body' section will it create any problem? – Saumil Nov 02 '13 at 10:10
  • What do you mean their own? If you use <@include then when the compiler compiles your jsp it creates ONE file per page.So all common parts will be copied in each servlet generated from each jsp. When you use – Anton Nov 02 '13 at 10:21
  • @Anton yep doubts are cleared now thanks (Y) – Saumil Nov 02 '13 at 10:23
  • 1
    includes are fine, but they quickly become an unmaintainable mess, and cause repetition. You'd better use a layout engine like SiteMesh or Tiles. – JB Nizet Nov 02 '13 at 10:41

1 Answers1

1

Remember that with each @include tag,the whole jsp thing will be converted to a servlet and then it will work as required HTML format as compiled by the browser. So there is no doubt that for a large application it will create unnecessary performance issue.
Instead of doing this you may use iframe tag which is now widely used in web development.
You may modify the iframe source code as u want........
So it's totally depends on which way you want to proceed and your application context.there is no fixed rule that you must have to use this or that technoque

Abhinab Kanrar
  • 1,532
  • 2
  • 20
  • 46