• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Share JSP from common JAR?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an application using Struts 1.2.9 (snickering isn't nice) with 2 web apps - each with their own struts-config.xml. This is run on a Servlet 2.5 engine in Weblogic 11g.

I need to share a JSP between the 2 web apps. That JSP currently resides in one of the web apps. I want to move the JSP to be part of a common JAR that both web apps use.

The action mapping in the app that currently contains the JSP has a context-relative URI to it in a 'forward' action, e.g., path="/dir/shared.jsp".

Is it possible to share this JSP and if so how?

Thanks.

Les
 
author & internet detective
Posts: 39435
768
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Les,
I don't think you can share the JSP. One possibility is to copy/paste it. I know copy/paste isn't great, but the alternative isn't great either. An alternative is to read the JSP into memory from a jar and have a servlet return the contents. Or write it to a temporary location or something. I don't think either of these alternatives is a good one.
 
Bartender
Posts: 9567
12
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a module in source control for common libraries and files. We check in the common code there, label it with a tag that links it to the other projects and set up the dependent project's build process to get a copy and put it where it needs to be. This way, we don't have to worry about which project has the "correct" version or have to make sure to update one file when we update the other. If the files do diverge down the road, we can simply fork the file in source control and maintain the two versions in the same place.
 
Les Hartzman
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys for the responses. I was kind of expecting this but hoping that a built-in capability existed short of reading the contents and paste in results.

Will probably have to go with Joe's idea of putting in 'build copying' to avoid duplication.

Les
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!