One web-app Multiple JSP sources...

My use case:

I am building a web application framework. I want most of the framework (UI, menus, save/load model) to be based on the same set of JSPs (using JSF). However I want to make modules represented by Jar files that, if present (on the classpath), provide the web application with new areas to navigate, or new configuration screens. I am choosing JSP because it is so easy to include JSF components, and use excellent AJAX technologies.

The problem I am facing is modularization. I might be re-using this web application in many different contexts and some of the configuration doesn't even make sense to put in the core module. I want it to be included simply by tagging on a dependency. The Jar being present in the web-app would be enough for a Service discovery mechanism to kick in and do some configuration magics.

So the solution I am thinking of is this:

When the web application starts up. I write some initialization code to do a module search. After all the modules are found via service discovery, those modules will have JSP files copied from a resource directory in the jar to the main JSP folder of the actual exploded jar.

My approach has a couple problems: 1) In the general case: there is no requirement for a WAR to explode at all, so copying may not even make sense. 2) If I put JSP files in Jars there is no way they can be easily edited. And during development I would like to edit, save, refresh... I don't think that would be practical at all using this approach.

So I ask, is there a better way to do this?

Before you reply with ditch JSP, I really want to use JSF. So I would need some alternative framework that is at least as fast as JSP and supports JSF. I plan on using rich-faces specifically.

Thanks, any help I am sure would be useful to many.

[1842 byte] By [homer400a] at [2007-11-27 9:28:24]
# 1
You might want to consider creating a custom ViewHandler, which would find the JSPs wherever you wanted to put them. You could a classloader that is capable of looking in JAR files or treating directories named like xyz.jar as JAR files for development purposes (JBoss does this).
RaymondDeCampoa at 2007-7-12 22:33:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...