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

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

问题描述

我有一个Java项目需要用到thgat;

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天全站免登陆