Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在创建一个TreeMapbean。我想在会话范围内传递它。但是,我需要重置/清除这个TreeMapbean。
TreeMap
这就是我声明我的bean的方式:
<jsp:useBean id="foo" class="java.util.TreeMap" scope="session"/>
任何关于如何清除/重置usebean(并继续使用相同的id)的想法将不胜感激。
如果您使用 c:setJSTL 标签并传入null,则该变量将被删除。另一种删除它使用的方法c:remove
c:set
null
c:remove
所以
<c:remove var="foo" scope="session"/>
或者
<c:set var="foo" scope="session" value="nullVar"/>
评估nullVar为null
nullVar