简体   繁体   中英

Getting Eclipse to automatically reload the JSP pages in my Java web application

I was given a template of a Struts project to work on, and I noticed that when I run the web project on integrated Tomcat in Eclipse and make changes to the .jsp viewpages, they don't automatically reload after a few seconds - which does happen in other projects I made myself.

So I figured this was a configuration issue and I did some research, I had a look at my Tomcat server settings:

(x) Automatically publish when resources change (1 second interval)

But because my own projects reload and I use the same server for them, I figured it must be an application specific issue. So I looked at context.xml to see if there was anything to change here

<Context 
...
reloadable="true"
...
>

Which I can only assume tells the server to indeed reload the application on changes.

So I really can't figure it out. It seems to me like everything is in order here. What am I missing?

From Apache Tomcat documentation about the Context attributes :

reloadable

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected . This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. That's why the default setting for this attribute is false. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.

Also maybe this will be interesting for you: Using Tomcat Reload Features To Speed Up Development

I ran into the same problem, with a Java/Spring project that I imported via its Maven .pom files into Eclipse.

I found that I had to run the project with "Debug" instead of "Run" - only then, changes to my .jsp files were noticed, so that a reload of the web page would show the changes almost instantly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM