JSP页面已缓存,无法更改,tomcat [英] JSP page is cached, can not change it, tomcat

查看:150
本文介绍了JSP页面已缓存,无法更改,tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java服务器,当我在JSP代码中进行更改时,又从浏览器再次调用该页面,则未显示我的更改,该服务器返回了旧的JSP.

I have a java server, when I change something within the JSP code, and I call the page again from the browser, my changes are not shown, the server returns the old JSP.

有人知道为什么吗?

推荐答案

《 Jasper操作方法》 conf/web.xml中告诉您,对于您的org.apache.jasper.servlet.JspServlet,您需要:

The Jasper How-to tells that in conf/web.xml, for your org.apache.jasper.servlet.JspServlet you need:

  • development-Jasper是否在开发模式下使用?如果为true,则可以通过ModifyTestInterval参数指定检查JSP的频率.true或false,默认为true.
  • checkInterval-如果development为false并且checkInterval大于零,则启用后台编译. checkInterval是两次检查是否需要重新编译JSP页面(及其相关文件)之间的时间(以秒为单位).默认值为0秒.
  • development - Is Jasper used in development mode? If true, the frequency at which JSPs are checked for modification may be specified via the modificationTestInterval parameter.true or false, default true.
  • checkInterval - If development is false and checkInterval is greater than zero, background compiles are enabled. checkInterval is the time in seconds between checks to see if a JSP page (and its dependent files) needs to be recompiled. Default 0 seconds.

<Context>元素具有以下属性:

The <Context> element has the following properties:

  • reloadable-如果要除jsp文件之外还热部署类和库,则设置为true
  • antiResourceLocking-应该为假
  • reloadable - set to true if you want hot-deployment of classes and libs in addition to jsp files
  • antiResourceLocking - should be false

以上所有都是关于服务器的.客户端缓存是您可能看不到较新版本的页面的另一个原因.只需按CTRL + R/CTRL + F5通常就足够了.

All the above was about the server. Client-side caching is another reason why you may not see newer version of pages. Simply hitting CTRL+R / CTRL + F5 often suffices.

决定缓存策略是不同的,也是一个不同的主题-您将告诉浏览器缓存哪些资源以及持续多长时间.最好将缓存标头-ExpiresCache-Control(和Pragma)放在应用程序中的公共位置,以便可以快速更改它.

Deciding your cache strategy is something different, and a different topic - what resources would you tell the browser to cache, and for how long. Preferably you should put the cache headers - Expires and Cache-Control (and Pragma) in a common location in your application, where you can change it quickly.

这篇关于JSP页面已缓存,无法更改,tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆