包含文件可以从另一个包含文件中调用函数吗?

时间:2022-04-11 15:59:20

I am new to working with jsp.
The scenario is that all of the jsp pages will always have include file A. Some of these pages will need to call functions from include file B. My question is, can I call a function from include file A from functions inside include file B?

我是jsp的新手。场景是所有jsp页面都将包含文件A.这些页面中的一些将需要从包含文件B调用函数。我的问题是,我可以从包含文件B中的函数调用包含文件A的函数吗?

Wikipedia says:

It is as if the contents of the included file were pasted directly into the original file.

就好像包含文件的内容直接粘贴到原始文件中一样。


This makes me think that this is allowed although I am not sure if this is a good practice or not.

这让我觉得这是允许的,虽然我不确定这是不是一个好的做法。

1 个解决方案

#1


Yes, you can absolutely call a function in include file A from include file B.

是的,您可以从包含文件B中完全调用包含文件A中的函数。

You may wish to consider using EL/JSTL rather than scriptlets.

您可能希望考虑使用EL / JSTL而不是scriptlet。

#1


Yes, you can absolutely call a function in include file A from include file B.

是的,您可以从包含文件B中完全调用包含文件A中的函数。

You may wish to consider using EL/JSTL rather than scriptlets.

您可能希望考虑使用EL / JSTL而不是scriptlet。