在action的execute方法中使用

servlet.getServletContext()可以得到像jsp中一样的application对象

servlet.getServletContext().getRealPath("/upload");