使用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();

相关文章:

  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-10-06
  • 2021-07-10
  • 2022-12-23
  • 2021-09-05
猜你喜欢
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-08-07
相关资源
相似解决方案