jsp service bean
//在jsp中使用后台service中方法需要在jsp页面引入service bean
1 <%@page import="com..entity.Users"%>
<%@page import="com.service.UsersService"%>
<%@page import="com.service.UserAmountLogService"%>
<%@page import="com.entity.UserAmountLog"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<jsp:useBean id="userAmountLogService" class="com.service.impl.UserAmountLogServiceImpl"/>
<jsp:useBean id="usersService" class="com.service.impl.UsersServiceImpl"/>
<%
ApplicationContext context =WebApplicationContextUtils. getWebApplicationContext(application);
UserAmountLogService amountLogService =(UserAmountLogService)context.getBean("userAmountLogService");
UsersService userService=(UsersService)context.getBean("usersService");
%>
jsp service bean的更多相关文章
- Spring MVC不要在@Service bean中保存状态
先看这么一段代码: @Service public class AccountService { private String message; public void foo1() { if (tr ...
- 非Controller类无法使用Service bean解决方案
尝试方案: 1 在Spring的配置文件springmvc.xml中,增加扫描项base-package="zxs.ssm.util",增加你需要使用service的类所在的包 ...
- 学生管理系统开发代码分析笔记:jsp+java bean+servlet技术
1 序言 学习java web的时候很渴望有一份完整的项目给我阅读,而网上的大部分项目拿过来都无法直接用,好不容易找到了一个学生管理系统也是漏洞百出.在此,我将边修改边学习这份代码,并且加上完全的注释 ...
- Java后台代码调用Spring的@Service Bean的方式
比如:在我的project中有一个类CompassIndexOperation,以: @Service("CompassIndexOperation") @Transactiona ...
- spring springboot websocket 不能注入( @Autowired ) service bean 报 null 错误
spring 或 springboot 的 websocket 里面使用 @Autowired 注入 service 或 bean 时,报空指针异常,service 为 null(并不是不能被注入). ...
- 过滤器手动注入Service Bean方法
@Override public void init(FilterConfig arg0) throws ServletException { ServletContext servletContex ...
- JSP之Bean
<jsp:useBean id=" " class" "/>创建JavaBean对象,并把创建的对象保存到域对象 比如:<jsp:useBea ...
- 在filter中使用spring的service bean
http://blog.csdn.net/godha/article/details/13025099
- (原创)ssm sql 例子(freemarker+jsp)
ssm整合地址:http://www.cnblogs.com/xiaohuihui96/p/6104351.html 接下讲解一个插入语句的流程和顺带讲解freemarker+jsp视图的整合 初次接 ...
随机推荐
- 【vlfeat】O(n)排序算法——计数排序
今天想在网上找一个实现好的er算法来着,没啥具体的资料,无奈只能看vlfeat的mser源码,看能不能修修补补实现个er. 于是,看到某一段感觉很神奇,于是放下写代码,跑来写博客,也就是这段 /* - ...
- springmvc.xml标配配置
这里提供配置模板[绝不会多余]: <context:component-scan base-package="com.atguigu"></context:com ...
- JavaSE---环境配置
1.概述 1.1 PATH环境变量 a,Java程序 编译.运行时 需要用到java.javac命令,虽然计算机中已经安装了JDK,但是计算机不知道去哪里找这个命令: b,计算机如何查找命令呢 ...
- 【leetcode】909. Snakes and Ladders
题目如下: 解题思路:天坑题,不在于题目多难,而是要理解题意.题目中有两点要特别注意,一是“You choose a destination square S with number x+1, x+2 ...
- 饿了么监控系统 EMonitor 与美团点评 CAT 的对比
背景介绍 饿了么监控系统EMonitor:是一款服务于饿了么所有技术部门的一站式监控系统,覆盖了系统监控.容器监控.网络监控.中间件监控.业务监控.接入层监控以及前端监控的数据存储与查询.每日处理总数 ...
- ofbiz:找不到org.ofbiz.widget.ContentWorkerInterface的类文件
ofbiz编译报错: 找不到org.ofbiz.widget.DataResourceWorkerInterface的类文件 找不到org.ofbiz.widget.ContentWorkerInte ...
- 03-树2 List Leaves(25 分)
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. I ...
- 二叉树入门(洛谷P1305)
题目描述 输入一串完全二叉树,用遍历前序打出. 输入输出格式 输入格式: 第一行为二叉树的节点数n. 后面n行,每一个字母为节点,后两个字母分别为其左右儿子. 空节点用*表示 输出格式: 前序排列的完 ...
- [CSP-S模拟测试60]题解
回去要补一下命运石之门了…… A.嘟嘟噜 给定报数次数的约瑟夫,递推式为$ans=(ans+m)\% i$. 考虑优化,中间很多次$+m$后是不用取模的,这种情况就可以把加法变乘法了.问题在于如何找到 ...
- [NOIP模拟33]反思+题解
又考了一次降智题…… 拿到T1秒出正解(可能是因为我高考数学数列学的海星?),分解质因数以后用等比数列求和计算每个因子的贡献.但是当时太过兴奋把最后的$ans \times =$打成了$ans +=$ ...