How to deploy jsp file for tomcat?

I do not want to create a war file every time I just do a little editing in the jsp file. I want to work as php. so how to quickly deploy tomcat server? Is hot-deploy a java standard?

Can I use this type of hot-deploy in the version for my software?

+1
java jsp tomcat
Feb 21 '13 at 21:37
source share
2 answers

Since the related question does not go into details ...

In $CATALINA_BASE/conf/server.xm l you need to configure the local server to unpack the WAR. Here is an example of my development server:

  <Host appBase="webapps" autoDeploy="true" deployOnStartup="true" deployXML="true" name="localhost" unpackWARs="true"> 

By default, Tomcat checks for changes in JSP files. In fact, you have to change this for production, as described here .

With these changes, you will find your web application at $CATALINA_BASE/work/Catalina/localhost (suppose, again, to set the default, if you configure the server name, it will not be localhost ). Edit the file in place and the changes will appear when the next page loads.

Is it possible to use this kind of hot-deploy in the release of my software version.

Not if you want to avoid errors with errors.

+5
Feb 21 '13 at 21:54
source share

Today I ran into the same problem, and using exploding .war just didn't cut it for me.

My solution was also to use the following context.xml file in Tomcat ( $CATALINA_BASE\conf\context.xml ):

 <Context reloadable="true"> <Resources cachingAllowed="false" cacheMaxSize="0" /> <WatchedResource>WEB-INF/web.xml</WatchedResource> <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource> <Manager pathname="" /> </Context> 

I also used the following in my Jsp for client-side cache:

 <% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 response.setHeader("Pragma","no-cache"); //HTTP 1.0 response.setDateHeader ("Expires", 0); %> 

after rebooting tomcat, you could just copy Jsp to $CATALINA_BASE\webapps\<context>\WEB-INF\...

and do a quick reboot (F5) in my browser to see the changes.

Bonus: Tomcat also reloads all its resources when I copy .class or .jar files to / WEB -INF now :)

0
Oct 11 '17 at 14:10
source share



All Articles