Custom JSP tag - detect existence of other instances

随声附和 提交于 2019-12-12 15:52:03

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/1789373/custom-jsp-tag-detect-existence-of-other-instances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!