[英]How can I include(load) more than one jsp files in spring mvc controller class?
How can I include(load) more than one jsp files in spring mvc conroller class? 如何在Spring MVC Conroller类中包含(加载)多个JSP文件?
eg: 例如:
@RequestMapping("/")
public void welcome() {
include("file1.jsp");
include("file2.jsp");
include("file3.jsp");
}
At framework level, No you cannot do it. 在框架级别,不可以。 However, there is a hack you could try.
但是,您可以尝试使用一种破解方法。
Create an array of name of pages you need to merge. 创建需要合并的页面名称的数组。 Send it as a parameter to a dummy empty page.
将其作为参数发送到虚拟空白页。
The dummy page does this: 虚拟页面执行以下操作:
<c:forEach var="page" items="${pages}">
<c:import url="${page}"></c:import>
</c:forEach>
This will iterate all the JSP files that you wish to show as a single view. 这将迭代您希望显示为单个视图的所有JSP文件。
Hope this helps. 希望这可以帮助。 Let me know if any further help is required.
让我知道是否需要任何进一步的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.