Come da Oggetto: esiste un modo?
In Tomcat è alquanto semplice, tramite la seguente istruzione:
CommonUtil.getHttpSession().getServletContext().ge tRealPath("/");
Come da Oggetto: esiste un modo?
In Tomcat è alquanto semplice, tramite la seguente istruzione:
CommonUtil.getHttpSession().getServletContext().ge tRealPath("/");
L'uso di getRealPath di ServletContext è corretto ma c'è da tenere presente la nota fornita nel javadoc.Originariamente inviato da natasha
getServletContext().getRealPath("/");
This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive).
Andrea, andbin.dev – Senior Java developer – SCJP 5 (91%) • SCWCD 5 (94%)
java.util.function Interfaces Cheat Sheet — Java Versions Cheat Sheet