Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

include a file between webapps

 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a header file which I'd like to share between multiple webapps. Is this possible? The directory structure is below:

webapps/ist/includes/header.jsp
webapps/forms/includes/header.jsp


It seems silly to have to duplicate the header.jsp file just because these are in different webapps. Especially since I'm using single sign on. But none of the below work:



Am I going to be forced to duplicate this header.jsp page?

Thanks,
Jim
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems silly to have to duplicate the header.jsp file just because these are in different webapps.


Sorry, but silly as it may seem to you, sharing resources across webapps is not a good idea. As you have seen, the mechanisms inherent in web application containers (as outlined in the specifications) focus heavily on making web applications self-contained units.

Trying to create artificial bindings between discrete web applications is not only technically difficult (because you are bucking the intentions of the specifications), but is just bad architectural design as it creates artificial dependencies between the apps.

Rather, you can have a single source for the shared resource, but copy it to each web application as necessary during the automated build process. This way, you manage the shared resource at build time, rather than trying to do so with execution-time mechanisms.
[ August 18, 2005: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic