Hi all, I have a model that look up an html file for being shown. But I have an issue regarding how to get the file without matters if the site is in deployment or development mode.
I thought the following, URL input=classComponent.getResource("help.html"); My html files are in "/WEB-INF/html/com....." and my classes are in "/classes/com...." How can I find the resource accurately taking into account the a component? thanks in advance public class HtmlModel extends AbstractReadOnlyModel { private static final long serialVersionUID = 9079057140521991184L; @SuppressWarnings("unused") protected static Logger log = Logger.getLogger(HtmlModel.class); @SuppressWarnings("unchecked") private Class classComponent; private String name; @SuppressWarnings("unchecked") public HtmlModel(String name, Class component){ this.name=name; this.classComponent=component; } @Override public Object getObject() { BufferedReader reader=null; StringBuffer html = new StringBuffer(); try { String aux=null; URL input=classComponent.getResource(name); reader = new BufferedReader(new InputStreamReader(input.openStream())); while((aux=reader.readLine()) != null){ html.append(aux); } } catch (IOException e) { log.error(e); } finally { try { reader.close(); } catch (Exception e) { log.error(e); } } return html.toString(); } } -- Fernando Wermus. www.linkedin.com/in/fernandowermus