首先在配置文件里注明bean,如下所示:
<beans:bean id="clientService" class="cn.bandlive.service.impl.ClientServiceImpl">
<property name="clientMapper" ref="clientDao"></property>
<property name="clientThirdplatformMapper" ref="clientThirdplatformDao"></property>
</beans:bean>
然后在jsp的<%%>中通过WebApplicationContextUtils工具类获取ApplicationContext对象,如下所示:
ApplicationContext ctx =
WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
ClientService clientService = (ClientService) ctx.getBean("clientService");
这样你就可以调用clientService里面的方法了。