I am creating a web application and upon user registration I would like to create a html file named by that username (i.e. joebloggs123 is username, therefore the html file is joebloggs123.html). I would like to use a template html file as it will cover basic profile content for the user when created.
So far I have the following:
File htmlTemplateFile = new File("/Convocast-war/web/userTemplate.html");
String htmlString = FileUtils.readFileToString(htmlTemplateFile);
String title = username + "'s Profile";
htmlString = htmlString.replace("$title", title);
File newHtmlFile = new File("/userPages/" + username + ".html");
You can use ServletContext.getRealPath() to locate that file.
change your first line to:
File f = new File(getServletContext().getRealPath("/userTemplate.html"));