【发布时间】:2015-01-08 16:46:58
【问题描述】:
我正在从 Strut1 + Tiles 项目迁移到 SpringMVC 和 Apache Tiles 3。我对 Struts1+Tiles 知之甚少,它太旧了,我被困在 Struts-tiles 中的 Controller 和 ComponentContext 中。根据 apache 网站的文档,它已被 ViewPreparer 和 AttributeContext 取代,但我不知道以下行的含义:ComponentContext compContext=(ComponentContext)pageContext.getAttribute(ComponentConstants.COMPONENT_CONTEXT,PageContext.REQUEST_SCOPE);ComponentConstants.COMPONENT_CONTEXT 是什么?以及如何将ComponentContext 更改为AttributeContext
请帮忙,谢谢。
【问题讨论】:
-
我认为您将很难找到可以帮助您使用 Struts-1 天的 Tiles 的人。有关于重新使用tiles-1 配置tiles.apache.org/2.1/framework/migration/configuration.html 的文档,但在这里您希望将其移至删除了这种配置样式的tiles-3。也许如果您发布一个更大的示例,我可能会帮助您,我至少可以解释 AttributeContext 的作用,但我不能保证任何事情。
-
感谢您的考虑,我正在维护一个非常大的项目,这里很难解释。在我看来,ComponentContext 存储了我们在切片定义中放入的值,我们可以通过上面的代码行在 Java 代码中获取它。在图块 3 中,不再使用 ComponentContext 并由 AttributeContext 取代。但我不知道如何在像 ComponentContext 这样的 Javacode 中获取它。请帮忙!
标签: java spring-mvc migration struts-1 apache-tiles