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 @   flay  阅读(326)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示