//Keeping track of user session and notes
NotesService notesService = ctx.getBean("notesService", NotesService.class);
//Pulls user session and confirms they are logged in
Users u = (Users) session.getAttribute("userSession");
if (u == null) {
response.sendRedirect("Login.jsp");
}
if (!u.getEnabled()) {
response.sendRedirect("Login.jsp");
}
String noteName = request.getParameter("delete");
//Find the relative path of the notesRepo folder to append to note name for saving
String relativeWebPath = "WEB-INF/notesRepo";
String absoluteDiskPath = getServletContext().getRealPath(relativeWebPath);
File file = new File(absoluteDiskPath + "/" + u.getId() + "/" + noteName);
boolean success = file.delete();
if (success) {
//Update database with the note deletion
Notes theNote = notesService.findOne(noteName);