jsp service bean

//在jsp中使用后台service中方法需要在jsp页面引入service bean
1
<%@page import="com..entity.Users"%> 2 <%@page import="com.service.UsersService"%> 3 <%@page import="com.service.UserAmountLogService"%> 4 <%@page import="com.entity.UserAmountLog"%> 5 <%@page import="org.springframework.context.ApplicationContext"%> 6 <%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%> 7 <jsp:useBean id="userAmountLogService" class="com.service.impl.UserAmountLogServiceImpl"/> 8 <jsp:useBean id="usersService" class="com.service.impl.UsersServiceImpl"/> 9 <% 10 ApplicationContext context =WebApplicationContextUtils. getWebApplicationContext(application); 11 UserAmountLogService amountLogService =(UserAmountLogService)context.getBean("userAmountLogService"); 12 UsersService userService=(UsersService)context.getBean("usersService"); 13 %>

 

posted @ 2015-07-22 11:14  flay  阅读(311)  评论(0编辑  收藏  举报