jsp中获取bean

来源:互联网 发布:Ubuntu和debian配置 编辑:程序博客网 时间:2024/05/27 21:49

ServletContext context = request.getSession().getServletContext();

ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(context);

UserService us = (UserService)ctx.getBean("UserService");

0 0