Reusing Java GUI web Component and it´s controller in more than one WAR
posted 4 years ago
Hello! Here is my first message into this forum. Thanks for the reading and congrats for a great site!
Under a Java EE enviroment, I have a web page built including several JSP files. Lets say one of the included JSP is header.jsp. Can be very similar to the one used by Stackoverflow, showing info about the user, links etc. This JSP is linked to a java controller to fetch user info, and is part of my WAR file including all the web application.
To develop it I used Eclipse and to build and package it I use Maven.
Now I need to build a new webApplication (so a new war) and I want to reuse the header.
What I pretend is:
not to duplicate code
both wars use one version of the header code
So the question is:
There is way to avoid copy & pasting both files (header.jsp & controller.java) from old project to the new one?