网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

Oneoftheusecasesinyourwebapplicationusesmanysession-scopedattributes.Attheendoftheusecase,youwanttoclearoutthissetofattributesfromthesessionobject.Assumethatthisstaticvariableholdsthissetofattributenames:201.privatestaticfinalSetUSE_CASE_ATTRS;202.static{203.USE_CASE_ATTRS.add("customerOID");204.USE_CASE_ATTRS.add("custMgrBean");205.USE_CASE_ATTRS.add("orderOID");206.USE_CASE_ATTRS.add("orderMgrBean");207.}Whichcodesnippetdeletestheseattributesfromthesessionobject?()

A.session.removeAll(USE_CASE_ATTRS);

B.for(Stringattr:USE_CASE_ATTRS){session.remove(attr);}

C.for(Stringattr:USE_CASE_ATTRS){session.removeAttribute(attr);}

D.for(Stringattr:USE_CASE_ATTRS){session.deleteAttribute(attr);}

E.session.deleteAllAttributes(USE_CASE_ATTRS);


参考答案

更多 “ Oneoftheusecasesinyourwebapplicationusesmanysession-scopedattributes.Attheendoftheusecase,youwanttoclearoutthissetofattributesfromthesessionobject.Assumethatthisstaticvariableholdsthissetofattributenames:201.privatestaticfinalSetUSE_CASE_ATTRS;202.static{203.USE_CASE_ATTRS.add(customerOID);204.USE_CASE_ATTRS.add(custMgrBean);205.USE_CASE_ATTRS.add(orderOID);206.USE_CASE_ATTRS.add(orderMgrBean);207.}Whichcodesnippetdeletestheseattributesfromthesessionobject?()A.session.removeAll(USE_CASE_ATTRS);B.for(Stringattr:USE_CASE_ATTRS){session.remove(attr);}C.for(Stringattr:USE_CASE_ATTRS){session.removeAttribute(attr);}D.for(Stringattr:USE_CASE_ATTRS){session.deleteAttribute(attr);}E.session.deleteAllAttributes(USE_CASE_ATTRS); ” 相关考题