阿录帮帮忙—ssh框架中,简单自定义标签SimpleTagSupport如何注入service
来源:互联网 发布:sql注入攻击典型做法 编辑:程序博客网 时间:2024/05/29 19:13
权限太多,想用简单自定义标签来控制按钮的显示:但遇到一个头疼的问题,不能用@autowird自动注入spring管理的service,让人恼火;
经过周折,终于解决问题,与大家一起分享,可能不是最好的方法,但很实用,希望有更好方法的人能推荐给我,谢谢;
public class IfHasPublish extends SimpleTagSupport { @Override public void doTag() throws JspException, IOException { //注入service ServletContext servletContext = ((PageContext) this.getJspContext()) .getServletContext(); WebApplicationContext wac = WebApplicationContextUtils .getWebApplicationContext(servletContext); IAssessBankService assessBankService = (IAssessBankService) wac .getBean("assessBankService"); IBaseParamService baseParamService = (IBaseParamService) wac .getBean("baseParamService"); // 获取用户登陆后保存的Session PageContext page = (PageContext) this.getJspContext(); User user = (User) page.getSession().getAttribute("activeUser"); Integer flg = assessBankService.ifHasPublish(user, baseParamService .getBaseParam().getYear()); switch (flg) { case 0: this.getJspBody().invoke(null); break; default: break; } }}
- 阿录帮帮忙—ssh框架中,简单自定义标签SimpleTagSupport如何注入service
- Java创建自定义标签SimpleTagSupport并在页面中使用
- 利用 SimpleTagSupport 开发自定义标签
- 利用 SimpleTagSupport 开发自定义标签
- SimpleTagSupport自定义标签的使用
- 利用SimpleTagSupport接口自定义标签
- 利用 SimpleTagSupport 开发自定义标签
- 阿录帮帮忙—maven+springMVC+hibernate
- 用SimpleTagSupport类开发自定义标签
- JSTL自定义标签二SimpleTagSupport(一)
- JSTL自定义标签二SimpleTagSupport(二)
- JSTL自定义标签二SimpleTagSupport 生命周期(三)
- 【jsp】使用SimpleTagSupport自定义标签库
- Taglib自定义标签之五SimpleTagSupport使用
- jsp 自定义标签-SimpleTagSupport 使用笔记
- 阿录帮帮忙—第五章—action中常用属性介绍
- SSH框架中Struts注入Service对象总是出现null的解决方案
- 阿录帮帮忙—java开发,tomcat插件部署项目
- 计算分段函数值
- java拼接tree结构的数据返回展示给flex前台
- 程序员的路在何方?
- 菜单
- pom.xml 文件报错 Missing artifact com.sun:tools:jar:1.5.0:system
- 阿录帮帮忙—ssh框架中,简单自定义标签SimpleTagSupport如何注入service
- 今天第一次写博客
- PT生存法则(不断补充中)
- HDU-1754 I Hate It 线段树
- codeforces 358A Dima and Continuous Line(思维简单,做法暴力)
- oracle表空间相关操作
- session.createQuery()与createSQLQuery()区别 .
- HBase的Compact和Split源码分析与应用--基于0.94.5
- BMP 转 YUV (BMP2YUV)