//在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 %>