You'd have to register a customereditorconfigurer along with a PropertyEditor that is capable of resolving Strings to URLs. The difficulty here is that you need the servletcontext or the application context.
This is resolved by extending implementing ApplicationContextAware and casting it to a WebApplicationContext (so this only works in WebApplicationContext):
Code:
public void UrlResourceEditor
extends PropertyEditorSupport
implements ApplicationContextAware {
ApplicationContext ctx;
public void setApplicationContext() { .. }
public void setAsText(String text) {
WebApplicationContext webAppCtx = (WebApplication)ctx;
Resource res = webAppCtx.getResource(text);
setValue(res.getUrl());
}
}
Register the custom editor using the CustomEditorConfigurer (see sect. 3.13 of the reference manual).