Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problem with JSP Includes

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP file which includes a lot of JSPs for purposes of modularity. But I am having to include the taglibs and javascript files that we use in every JSP file that has been included. That way , I am import files in every JSP file. I wanted to know if there is a way to import all of these files in one location and make them available to all the JSPS
 
Marshal
Posts: 67414
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by kartik krishnanand:
I have a JSP file which includes a lot of JSPs for purposes of modularity.



If you are using JSP 2.0, tag files would be a better mechanism for this purpose.

But I am having to include the taglibs and javascript files that we use in every JSP file that has been included. That way , I am import files in every JSP file.



If you are worried that this is going to cause any sort of a performance issue, rest easy. The "import" is a translation-time artifact and will not affect run-time performance.

However, it is a pain in the neck, as well as error-prone, to copy the declarations on each and every page. You may want to explore the concept of a JSP prelude.

More information can be found in the JSP Specification.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic