博客 / 詳情

返回

在jsp裏, 調用容器,使用sevice

  • jsp獲取spring容器
<%

ServletContext sc = this.getServletConfig().getServletContext();
ApplicationContext ac2 = WebApplicationContextUtils.getWebApplicationContext(sc);

RedisService redisService=(RedisService)ac2.getBean("redisService");

%>
  • service demo

@Service("redisService")

user avatar
0 位用戶收藏了這個故事!

發佈 評論

Some HTML is okay.