自定义 JSP 标记 - 检测其他实例的存在

发布于 2024-08-12 09:49:43 字数 144 浏览 2 评论 0原文

自定义 JSP 标记是否可以检测页面中是否存在其自身的其他实例?如果是这样,首选的方法是什么?我的标签的输出需要有条件地取决于它是否是唯一的实例。

请注意,我的页面出现了三次标签,其中两个具有与第三个不同的属性集,因此我知道从资源池分配了两个单独的标签实例。

Is it possible for a custom JSP tag to detect if there are other instances of itself within a page? If so, what's the preferred way to do this? My tag's output needs to be conditional dependent upon whether it's the only instance or not.

Note that my page has three occurences of my tag, two of which have a different set of attributes from the third, so I know that there are two separate instances of the tag allocated from the resource pool.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谈情不如逗狗 2024-08-19 09:49:43

您可以使用 PageContext#setAttribute()getAttribute()

You could make use of the PageContext#setAttribute() and getAttribute().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文