Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Struts2 中,如何在所有页面中共享您的通用 html?
在 Asp.net 中有母版页,而在 Rails 中有布局。这个想法是您的常用 html(例如标题、菜单和样式)都易于维护,因为它们都在一个地方,但是对于我来说,我无法在 Struts2 中找到等效的功能。
是叫别的什么,还是叫什么,这就是我找不到它的原因吗?
我已经使用 Tiles2 和 SiteMesh 来实现这一点。
Tiles 是基于您定义页面及其结构的配置(通常在 xml 中)
SiteMesh 基于装饰器,其中您有一个模板,该模板通过过滤器应用于结果页面。SiteMesh 由于在过滤器中进行了重新样式化,因此在服务器端使用了更多内存,因此必须对结果页面的 html 进行解析和应用。