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 %>
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步