Fast Deployment JSP in Web Slice Using Eclipse and Tomcat (Servlet 3.0)

I have a project created as follows:

/parent /core /src/main/ /resources/META-INF/ web-fragment.xml /resources/jsp/ fragment.jsp /java/ FragmentTest.java /web /src/main/ /webapp/ /WEB-INF/web.xml /jsps/ parent.jsp /java/ ParentTest.java 

The core is compiled into .jar inside .war.

However, when deploying this to Tomcat with debugging enabled, I can edit parent.jsp and it will be hot, but if I update the .jsp fragment, then it will not, and I will have to rebuild / repost / etc.

However, any changes to .java in any project will be hot-rolled successfully.

Does anyone know of any configurations, etc., that might be missing to make web fragment JSP applications work with hot deployment?

Thanks!

+4
source share
3 answers

You can deploy both JSPs and Java files if you do the following:

Separate the web fragment project into two different projects and access them from the main web applications:

  • One containing all of your Java source files (this project should be a web fragment). It will be packaged as a JAR file, and you can quickly deploy the Java files as you do now.
  • Another project is a dynamic web project containing all of your static / JSP files in the WebContent folder. This will be deployed without unpacking and will allow you to expand everything in the WebContent folder

There may be a better option than this, but at least you can work fine until you find something better.

+1
source

I have the same situation. I have test-web (your parent ) and test web fragment (your core) . I resolved them as follows:

In / test-web β†’ Properties β†’ Deployment Deployment, I added a File Set rule that points to / test-web-fragment / src / main / resources / META-INF / resources (see screenshots below).

When I change something on a page from a fragment, the eclipse builder copies it to / test-web / src / main / webapp . After that, I right-click on the test web application server and click Full Publish , and I have my changes on the server. I use this trick in development mode. When I make an assembly for production, I use maven without this rule.

1

2

3

+1
source

The structure of the project confuses me a little. We always host JSP in /src/main/webapp and subfolders. I understand very well that this is the source of your problem.

0
source

Source: https://habr.com/ru/post/1489563/


All Articles