Not sure why the following does not work now:
pageContext.setAttribute("cssurl", response.encodeURL("CSSURL"));
...
var link = document.createElement('link');
link.setAttribute('href', '<c:out value="${cssurl}"/>');
The following still works:
link.setAttribute('href', '<%=response.encodeURL("CSSURL")%>');