jsp或action中获得url路径

http://localhost:8080/rootWeb

String path = request.getScheme()   

                    +"://"  

                    + request.getServerName()   

                   + ":" + request.getServerPort()   

                    + request.getContextPath()  

 

String dir = servlet.getServletContext().getRealPath("/temp"); //当前文件夹temp所在路径

你可能感兴趣的:(jsp,servlet)