Good day. actually sabzh ... google rummaging - sense to 0 ... <br> I perfectly understand that this is not php and you need to rebuild the project, please tell me a version of this action that is adequate in terms of complexity and speed, but it really strains to reboot the server every time I perfectly understand that this is a duristics ... It would be desirable with an example. I am a complete noob in this business and I had enough apache + tomcat settings with my head, my nerves no longer stand ^^ <br> The last idea was to erase and restore the contents of web.xml, better than server reboot, but I hope I have normal ways. .. <p align = "right"> <small> <i> Thanks in advance ... </ i> </ small> </ p>

  • Nothing is clear what you want. Do you want to update the project without redeployment during development, or do you want to prevent page caching on client machines in production? - cy6erGn0m
  • Maximize redidlo body movements ... <br> no, it's not about production, but about comfortable learning ... <br> Now, to put it mildly, it's not comfortable ... You are steaming more with the server to see what you write ... - Zowie
  • Now every time I clear web.xml , then I request /servlet/servletName , respectively I get 404, then I return web.xml to normal again, then I update the url , then a few seconds wait and I'm ready ... <br> I think that I do duraltic poems and asked this question ... - Zowie
  • So this is not a JSP matter, but a servlet? - cy6erGn0m
  • Yes, as soon as I installed Tomcat, I figured out how to cache JSP, but I don’t have a clue how to deal with sideboards ... - Zowie

3 answers 3

Tomkat will check the classes in the application and automatically re-allocate it, if you set the context attribute reloadable="true" . If you have only one application, then you can install it globally (apply to all) in the $CATALINA_HOME/conf/context.xml file:

 <Context reloadable="true"> 

If the application is large, then after a while OutOfMemoryError will come to you.

PS Serious uncles use JRebel - it allows you to automatically update classes (as well as configs to many frameworks, etc.) without redeploying at all. I did not use it myself, but I read a lot about it and judging by the reviews - the thing.

  • Many thanks, really helped :) - Zowie

If you need this for development, then this is out of the box in Netbeans. In general, jsp should be updated themselves, and servlets - only when rebooting, unless tomcat is in debug mode. In general, it was described in detail in some book by Java.

  • I figured out JSP a long time ago, except for the sausages except restarting the server and dancing over the web.xml, I didn’t come up with anything ... <br> Now I’m in the process of learning and really straining to restart the server 10 times an hour ... - Zowie
  • Well, develop in Netbeans IDE - very convenient, you do not need to restart anything. - drakmail
  • Yes, I developed both in eclipse and netbeans, while you study me all these frills are not necessary, I am writing codes now for 20-100 lines, why should I pull this burden? If there is no other choice then, probably, it will have, is it really the only adequate option to use IDE? O_o - Zowie

In general, it is necessary to distinguish between JSP and servlets. If you are using exploded war (and you apparently are using, just say that you are correcting web.xml), then

for the JSP case, nothing is required. Just change the JSP and the server produces new ones.

when it comes to servlets, it's more complicated. The fact is that the classes are loaded into a virtual machine, so compiling and enclosing the class files is not enough. It is necessary redeploy (unless, of course, the debug mode is running). The easiest way to do this is to touch the .reload file. For example, using

 touch .reload 

If Windows, then you can simply delete the file .. the server will re-install everything and the file will appear again.

And of course, sooner or later, OutOfMemory will end.

And yes, as comrade above said, IDE can automate all this, so you don’t have to do it all by hand.

  • I didn’t have a class deletion in my account, it was already hanging in my memory all the same ... - Zowie