views:

29

answers:

2

Environment

  • IDE: Netbeans 6.9
  • App Server: Glassfish 3
  • Frameworks: Spring, Hibernate, Struts 2

Problem

I have 2 web applications. I want to share resources between them both - i.e. authentication form jsp and other assets (js - yui,jquery/images/css). I will be adding more web applications that will also require access to these common components.

As a last resort I will create another web project with just the common assets - including them via http://common.mydomain.

How has anyone else achieved this? Can I create a web resource jar/war and include this in both applications?

I am experimenting so will update question with any progress.

Many thanks.

A: 

Place these 'common' components in a separate module (or in several separate modules) and make a dependency to this module from other parts of your app. (I'm not sure how is it called in NetBeans, in IntelliJ IDEA it's called module, in Eclipse - it's a separate project in the same workspace).

Roman
A: 

In eclipse you must create an utility project and an ear project containing the utility project and your current web applications. You can then move common code to the utility project, and deploy the ear to glassfish.

Common resources must be located through the classpath. This is rather easy with JSF 2

Thorbjørn Ravn Andersen