Tapestry里怎么实现Jsp里的ServletContext.getRealPath("/")的功能。
getRequestCycle().getInfrastructure().getContextPath();
@InjectObject("service:tapestry.globals.WebContext")
public abstract WebContext getWebContext();
getWebContext().getRealPath("/upload/")
@InjectObject("infrastructure:contextPath")
public abstract String getContextPath();
Then write some computeUrl method similar to this one (just typed this in,
no guarantee that this will work).
public String computeUrl() {
String locale = getLocale().getCountry().toLowerCase();
return getContextPath() + "/Public/flags/" + locale + ".gif";
}