private String toPath(Resource res) {
if(!(res instanceof FileResource)) return res.getAbsolutePath();
//Config config=pageContext.getConfig();
PageSource ps = pageContext.toPageSource(res,null);
if(ps==null) return res.getAbsolutePath();
String realPath = ps.getRealpath();
realPath=realPath.replace('\\', '/');
if(realPath.endsWith("/"))realPath=realPath.substring(0,realPath.length()-1);
//print.out("real:"+realPath);
String mapping=ps.getMapping().getVirtual();
mapping=mapping.replace('\\', '/');
if(mapping.endsWith("/"))mapping=mapping.substring(0,mapping.length()-1);
return mapping+realPath;