In Apache Wicket, the framework expects the HTML templates to mirror the class-file directory structure. The example below allows you to define a different path for your HTML files. public class PathStripperLocator extends ResourceStreamLocator { public PathStripperLocator() { } public IResourceStream locate(final Class clazz, final String path) { IResourceStream located = super.locate(clazz, trimFolders(path)); if (located != null) { return located; } return super.locate(clazz, path); } private String trimFolders(String path) { return path.substring(path.lastIndexOf("/") + 1); } }
Share this post
Modify Where Wicket Loads HTML Templates
Share this post
In Apache Wicket, the framework expects the HTML templates to mirror the class-file directory structure. The example below allows you to define a different path for your HTML files. public class PathStripperLocator extends ResourceStreamLocator { public PathStripperLocator() { } public IResourceStream locate(final Class clazz, final String path) { IResourceStream located = super.locate(clazz, trimFolders(path)); if (located != null) { return located; } return super.locate(clazz, path); } private String trimFolders(String path) { return path.substring(path.lastIndexOf("/") + 1); } }