自定义JSP标记 - 检测其他实例的存在 [英] Custom JSP tag - detect existence of other instances
本文介绍了自定义JSP标记 - 检测其他实例的存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
自定义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.
推荐答案
你可以使用 PageContext#setAttribute()
和 getAttribute()
。
这篇关于自定义JSP标记 - 检测其他实例的存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文