简体   繁体   English

如何将System.currentTimeMillis()输出到ADF页面?

[英]How can I output System.currentTimeMillis() to an ADF page?

I'm using this and it doesn't work as expected. 我正在使用它,它没有按预期工作。 I'm trying to cache bust a css file as it changes a lot and we can't always expect users to thoroughly clear their cache. 我正在尝试缓存css文件,因为它发生了很多变化,我们不能总是期望用户彻底清除其缓存。

  <c:set var="buster" value="{System.currentTimeMillis()}" />
  <af:resource type="css" source="/oracle/webcenter/portalapp/shared/css/maaui.css?r=${buster}"/>

Unfortunately that renders 不幸的是

<link rel="stylesheet" type="text/css" afrres="true" href="/myAccount/oracle/webcenter/portalapp/shared/css/maaui.css?r=%7BSystem.currentTimeMillis()%7D">

It doesn't execute the method. 它不执行该方法。 I tried ${} and #{} as well and neither seem to work for me. 我也尝试过${}#{} ,但似乎都不适合我。 Can anyone help me to achieve the desired result? 谁能帮助我达到预期的效果? Basically a random string that will change each time a user visits a page. 基本上是一个随机字符串,它将在用户每次访问页面时更改。 I can easily do this in .NET but I am very new to Oracle ADF. 我可以在.NET中轻松地做到这一点,但是我对Oracle ADF还是陌生的。

Try 尝试

<c:set var="buster" value="{myBean.time}" />

<af:resource type="css" source="/oracle/webcenter/portalapp/shared/css/maaui.css?r=#{buster}"/>

And in MyBean managed backing bean 并在MyBean中管理后备bean

public long getTime()
{
return System.getCurrentTimeMillis();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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