Spring MVC Web应用程序中的模板

问题描述:

我在Web应用程序设计中有很多公共领域,例如页脚,页眉侧边栏,块...等,并且遍历所有应用程序JSP文件来更改页眉中的某些内容,例如,想知道是否可以为通用区域制作诸如模板文件之类的文件,例如标题模板,侧边栏模板,页脚模板,那么我可以在应用程序内的任何JSP中包含此类模板吗?

I have a lot of common areas in my web application design, for example footer, header sidebar, blocks...etc and going through all of the application JSP files to change something for example in the header is pretty hectic so I was wondering if I can make something like template files for common areas for example header template, sidebar template, footer template, then I can include such templates in any JSP inside my application?

我正在使用Spring MVC框架来构建我的应用程序

I am using Spring MVC framework to build my application

作为模板,您有以下选择:

As for templating you have the following options:

  1. 自定义JSP标记.这些标记可以作为Java类或JSP代码段存在,并提供封装和重用部分JSP页面(页眉,页脚等)的基本功能.在本手册

模板引擎(如标题)或修饰符(如Sitemesh .它们在构建复杂的页面布局方面非常强大.

Template engines like Tiles or decorators like Sitemesh. They are quite powerfull in building complex page layouts.

如果您正在寻找自定义UI主题支持,请在中查看自定义主题支持 Spring MVC.

If you're looking for custom UI themes support please take a look at custom themes support in Spring MVC.