在JSP页面中:
application.getRealPath("/");
Servlet中:
ServletConfig config = getServletConfig();
ServletContext application = config.getServletContext();
类别: 技术.jsp/servlet 查看评论
application.getRealPath("/");
Servlet中:
ServletConfig config = getServletConfig();
ServletContext application = config.getServletContext();
类别: 技术.jsp/servlet 查看评论
本文介绍了在JSP页面及Servlet中获取应用程序实际路径的方法。通过使用`application.getRealPath(/)`可在JSP中获得路径;而在Servlet环境中,则是先通过`getServletConfig()`获取配置对象,再利用此对象取得`ServletContext`,最终调用`getRealPath`方法来实现。
5042

被折叠的 条评论
为什么被折叠?



