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视图的整合 初次接 ...
随机推荐
- 进程调试--进程启动VS自动附加
程序启动VS自动附加到进程调试 1. 打开注册表regedit 2. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\currentversion\i ...
- securityDemo依赖
<dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit ...
- hdu1166 敌兵布阵 (线段树单点更新)
Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布置了N个工兵营 地,Derek和Tidy的任务就是要监视这 ...
- toleft时设置TabSequence属性为tsReversetoright时设置TabSequence属性为tsStandard
使用这2人控件时,属性taborientation设为toleft时有个问题,具体如下设为toleft时tab会跑到左侧,这时的tab上的文字是反的.当设置为toright时,tab在右侧,这时的ta ...
- python 标准模块和第三方模块
>>> help('modules') Please wait a moment while I gather a list of all available modules... ...
- 爬虫问题之Unknown command: crawl
出现这个问题,很大原因是爬虫没有在项目文件夹里运行,因为scrapy 这个爬虫框架封装好的一些命令,必须在框架内环境支持下才能运行 另外在环境目录下,还有很多命令,也必须在此路径环境下才能执行 可以通 ...
- Python 工程师技能图谱skill-map
# **Python 工程师技能图谱** ## **入门**- 笨办法学Py- 官方教程- Hitchhiker- coursera * codeskulptor.org ## **进阶/脚本** # ...
- leetcode上一些常见的链表问题
92-按规定区间反转链表 思路:可以考虑成一种把前后数字的结点断开重新组合的问题 /** * Definition for singly-linked list. * struct ListNode ...
- thinkphp 连接postgresql
PHP连接: php.ini中将extension=php_pgsql.dll前面的分号去掉extension=php_pdo_pgsql.dll前面的分号去掉,然后设置extension_dir指向 ...
- java对象属性为date oracle数据库字段为Timestamp 处理方式
解决方案 SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date da ...