Spring中的getServletConfig()。getServletContext()等效 [英] getServletConfig().getServletContext() equivalent in Spring

查看:487
本文介绍了Spring中的getServletConfig()。getServletContext()等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提到了很多帖子,但我仍然无法找到正确的工作答案。

我想从我的Java类中获取它而不是在jsp中使用EL。

I referred to a lot of posts but still I am unable to find a correct working answer.
I want to get it from my Java class itself and not using EL in jsp.

如何在Spring中获取servlet上下文路径?

How to get the servlet context path in Spring?

推荐答案

for SpringMVC

for SpringMVC

@Autowired
ServletContext servletContext;

这篇关于Spring中的getServletConfig()。getServletContext()等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆