Question

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.

  <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.

Was it helpful?

Solution

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

public long getTime()
{
return System.getCurrentTimeMillis();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top