包含动态属性值的文件 [英] Include file from dynamic property value

查看:106
本文介绍了包含动态属性值的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java需要使用的项目;

I have a project in Java thgat needs to use;

<%@include file="content.jsp" %>

将文件包含到当前的jsp页面中。

to include a file into the current jsp page.

但是,我现在需要content.jsp是动态的。

However, I now need the content.jsp to be dynamic.

如何用变量替换引号中的所有内容?

How can I substitute everything in the quotes with a variable?

所以;

<%@include file=myVariable %>


推荐答案

您可以使用动态包含而不是使用静态包含,那么你可以这样做: -

Instead of using static include, you can use dynamic include, then you can do something like this:-

<jsp:include page="<%= myVariable %>" flush="true" />

<jsp:include page="${myVariable}" flush="true" />

这篇关于包含动态属性值的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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