方法一:
1.首先在jsp中导入:
<jsp:directive.page import="org.springframework.web.context.WebApplicationContext"/>
2.然后可以调用spring容器管理的Bean了(这里实例调用的是CalendarMapper 对象):
Jsp中调用spring管理的Bean代码如下:
WebApplicationContext context = (WebApplicationContext)this.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
CalendarMapper calendarMapper = (CalendarMapper)context.getBean("calendarMapper");
方法二:
1.在jsp中导入: