如何使用 xPages 向客户端强制更新设计更改?

发布于 2025-01-06 20:31:04 字数 292 浏览 6 评论 0原文

我正在使用 xPages 构建一个网页,并且不断对脚本和设计进行更改,这包括服务器和客户端 javascript、样式表和图像更改。

每次我更改 javascript 或样式表时,我都希望在网络浏览器中看到我的更改,并且我还希望我的用户在访问网页时获得最新更改。

我知道我可以使用 Shift-Reload 或 CTRL-reload 并清除我的网络浏览器缓存。我也知道我可以更改对象的到期日期,但我想要一种更流畅、更好控制的方法来执行此操作。

寻找执行此操作的任何最佳实践。

谢谢

托马斯

I am bulding a webpage using xPages and I am making constant changes to script and design, this include both server and client javascript , stylesheet and image changes.

Each time I change a javascript or stylesheet I want to see my changes in the webbrowser and I also want my users to get the latest changes when they access the webpage.

I know I can use Shift-Reload, or CTRL-reload and clear my webbrowser cache. and I also know that I can change the objects expiration date, but I want a smoother and better controlled way to do this.

Looking for any kind of best practice for doing this.

Thanks

Thomas

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

云雾 2025-01-13 20:31:05

在应用程序的 xsp.properties 文件中或在服务器范围内使用的服务器上,您可以设置 xsp.application.forcefullrefresh=true。 xsp.properties 文件文档显示:

# 应用程序刷新
# 当此属性设置为 true 时,将请求完整的应用程序刷新
# 类的设计发生变化(意味着范围内的所有数据都被丢弃)。

# xsp.application.forcefullrefresh=false

新的 XSP 便携式命令指南说“此属性是在 Notes/Domino 8.5.3 中引入的。默认情况下它设置为 false,并且在 XPages 应用程序的开发阶段特别有用。”

我还没有完全测试这种行为,但听起来很有希望。当然,您可以/应该只在进行更改时将其设置为 true。一旦稳定,将其放回去。

/新闻网

In the xsp.properties file for the application or on the server for server wide use you can set xsp.application.forcefullrefresh=true. The xsp.properties file documentation says:

# Application refresh
# When this property is set to true, then a full application refresh is requested when
# the design of a class changes (means that all the data are discarded in scopes).

# xsp.application.forcefullrefresh=false

The new XSP Portable Command Guide says "This property was introduced in Notes/Domino 8.5.3. It is set to false by default and is particularly useful during the development phase of an XPages application."

I have not fully tested this behavior but it sounds promising. You could/should of course only set it to true WHILE you make the changes. once stable, set it back.

/Newbs

留一抹残留的笑 2025-01-13 20:31:05

添加费里的回答和您的评论;

您可以使用“?version=2.1”代替“?dummy=randomvalue”。所以它会被缓存,但是当你改变设计时,你可以只增加版本。

这种方法存在一个问题,因为某些代理服务器不会缓存带有查询参数的任何内容。最好直接重命名文件,添加日期或版本号。它将永远有效。

要暂时禁用缓存,请使用 Fiddler2。可以在任何 Web 客户端的一处轻松启用和禁用。以及 http 请求跟踪功能的额外好处。

Adding to Ferry's answer and your comment;

Instead of "?dummy=randomvalue", you can use "?version=2.1". So it will be cached but when you change design, you can just increase the version.

There's a problem with this approach as some proxy servers won't cache anything with query params. Better to rename the file directly, adding date or version number to it. It will always work.

To disable caching temporarily use Fiddler2. It's easy to enable and disable in one place across any web client. As well as added benefits for the http request tracking features.

瀞厅☆埖开 2025-01-13 20:31:05

要完全禁用任何缓存,请添加 url + '"?dummy=" + @Unique();'到 JavaScript 或图像文件的每个 url...

To fully disable any caching add url + '"?dummy=" + @Unique();' to every url to javascript or image files...

童话里做英雄 2025-01-13 20:31:05

我阅读这个问题的方式是,您希望所做的每项更改都立即显示在客户端的浏览器或客户端上。您真的确定要这样做吗?听起来您没有进行任何测试,因此任何拼写错误、错误、崩溃等都会传递给您的用户。对我来说听起来是个糟糕的计划。我希望我错了,您正在使用模板并仅将经过充分测试的更改推送到生产版本,而不是在生产版本中进行更改。

我只会制定一个时间表,说明何时将更改推送到生产环境,并让用户在那时重新加载他们的浏览器或客户端。或者在下班时间执行此操作,当他们下次登录时,他们会得到最新的更改。

The way I am reading this question is that you want every change you make to appear immediately on the client's browser or client. Are you really sure you want to do this? It sounds like you are not doing any testing so any typos, bugs, crashes, etc will be passed on to your users. Sounds like a bad plan to me. I hope I am wrong and that you are using a template and pushing only your fully tested changes up to an production version instead of making the changes in the production version.

I would just put out a schedule of when changes are going to be pushed up to production and let the users reload their browser or client at that time. Either that or do it during off hours and when they next log on, they get the newest changes.

爱的那么颓废 2025-01-13 20:31:05

添加费里的回答和您的评论;

您可以使用“?version=2.1”代替“?dummy=randomvalue”。所以它会被缓存,但是当你改变设计时,你可以只增加版本。

Adding to Ferry's answer and your comment;

Instead of "?dummy=randomvalue", you can use "?version=2.1". So it will be cached but when you change design, you can just increase the version.

冰雪之触 2025-01-13 20:31:05

也许你可以看看 domino 如何控制 url 的缓存。

http://www.ibm.com/developerworks/lotus/library/ls- resp_head_rules/

maybe you could look at how domino can control caching of url's.

http://www.ibm.com/developerworks/lotus/library/ls-resp_head_rules/

明天过后 2025-01-13 20:31:05

NEwbs 的答案是一个很好的答案,但值得注意的是,在 Firefox 中,有一个非常有用的插件,名为“Web Developer”,来自 Chris Pederick,它允许您禁用缓存。

http://chrispederick.com/work/web-developer/

另一个非常有用的是Firebug 真是太棒了 - 它使任何 HTML 工作变得更加容易

https://addons.mozilla.org/en-US/firefox/addon/firebug/

NEwbs answer is a good one but it is useful to note that in Firefox there is a very useful plug in called "web developer" from Chris Pederick that allows you to disable the cache.

http://chrispederick.com/work/web-developer/

The other really useful one is Firebug which is just amazing - It makes any HTML work much easier

https://addons.mozilla.org/en-US/firefox/addon/firebug/

江挽川 2025-01-13 20:31:05

我确实找到了另一个解决方案,将我的 css 和 js 放入主题中,只需重命名文件即可轻松完成。

如此处所述
http://goo.gl/vFTii

I did found another solution by putting my css and js in a theme it is easy to just rename the files.

as described here
http://goo.gl/vFTii

孤蝉 2025-01-13 20:31:05
Why do not we use the window.location.reload()...

Which does the same like ctrl+F5

It reloads the page, which is similar to context.reloadpage 
Why do not we use the window.location.reload()...

Which does the same like ctrl+F5

It reloads the page, which is similar to context.reloadpage 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文