tapestry+spring结合使用时加载底层server的方法
2005-07-20 12:15
609 查看
使用spring框架必须在使用时在各个页面加载对应的底层service,
tapestry+spring结合使用时,需要Engine类的支持:
先在MyEngine文件里添加如下方法:
protected void setupForRequest(RequestContext context) {
super.setupForRequest(context);
// insert ApplicationContext in global, if not there
Map global = (Map) getGlobal();
ApplicationContext ac = (ApplicationContext) global.get("appContext");
if (ac == null) {
ac = WebApplicationContextUtils.getWebApplicationContext(
context.getServlet().getServletContext()
);
global.put("appContext", ac);
}
}
然后在page文件里面使用如下语句就可以了:
<property-specification name="list" type="DataList" >
global.appContext.getBean("tableSource")
</property-specification>
此时名字为list,那么相对应得java文件的静态方法就必须是
public abstract TreeDao getList();
tapestry+spring结合使用时,需要Engine类的支持:
先在MyEngine文件里添加如下方法:
protected void setupForRequest(RequestContext context) {
super.setupForRequest(context);
// insert ApplicationContext in global, if not there
Map global = (Map) getGlobal();
ApplicationContext ac = (ApplicationContext) global.get("appContext");
if (ac == null) {
ac = WebApplicationContextUtils.getWebApplicationContext(
context.getServlet().getServletContext()
);
global.put("appContext", ac);
}
}
然后在page文件里面使用如下语句就可以了:
<property-specification name="list" type="DataList" >
global.appContext.getBean("tableSource")
</property-specification>
此时名字为list,那么相对应得java文件的静态方法就必须是
public abstract TreeDao getList();
相关文章推荐
- 定时器quartz结合spring使用(方法二MethodInvokingJobDetailFactoryBean)
- 51-ViewController的view的创建,使用init或initWithNibName方法加载xib的底层实现(图解)
- 使用JDBCTemplate实现与Spring结合,方法公用
- 使用JDBCTemplate实现与Spring结合,方法公用 ——Emp实现类(EmpDaoImpl)
- 使用Spring3.0的AOP结合log4j实现接口方法执行时间记录
- 定时器quartz结合spring使用(方法一JobDetailBean)
- 结合 spring 使用阿里 Druid 连接池配置方法
- 使用Springboot搭建OAuth2.0 Server的方法示例
- 使用JDBCTemplate实现与Spring结合,方法公用 ——接口(BaseDao)
- 解决tmpl插件与图片自动轮播插件结合使用,无法加载mytv()方法问题
- 使用JDBCTemplate实现与Spring结合,方法公用 ——Spring配置(applicationContext.xml)
- 使用JDBCTemplate实现与Spring结合,方法公用 ——测试(EmpDaoImplTest)
- server2008 加载驱动隐藏文件或文件夹方法,可在webshell下提权后使用,付切实可行办法
- 使用JDBCTemplate实现与Spring结合,方法公用 ——共用实现类(BaseImpl)
- Spring、Ibatis结合MySQL数据库的使用方法
- xmemcached与spring结合使用时连接超时问题解决方法(转)
- spring boot shiro结合使用,资源资源加载不到问题(filterchain的问题 ) 3ff8
- springboot中通用mapper结合mybatis generator的使用 通用mapper是为了方便开发人员对单表进行crud操作而产生的一套通用方法。 通用mapper只支持单表操作,可以
- springboot结合redis使用CachingConfigurerSupport方法不能被继承
- Struts2使用通配符加载配置文件和通配符方法的底层实现学习