如何在JSP中包括@include的运行时文件 [英] How to include a Runtime file for @include in JSP

查看:82
本文介绍了如何在JSP中包括@include的运行时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要在JSP中包含另一个文件,我们使用@include标记

To include another file in JSP, we use the @include tag

<%@ include file ="NameOfFile"%>

在我的情况下,我想包含一个HTML文件,其名称在运行时为人所知-即来自数据库.

In my case i want to include a html file whose name will known during the run-time - i,e from Database.

如何在JSP中执行此操作?

How can I do this in JSP?

推荐答案

仅使用jsp:include即可:

simply using jsp:include :

<jsp:include page="<%= htmlFileName %>" />

它在我的项目中有效,该项目将文件存储在会话中,以正确地重新加载使用ajax更新的部分

It works in my project where the file is stored in session to reload correctly the part updated with ajax

这篇关于如何在JSP中包括@include的运行时文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆