阅读下面代码: Book book = BookDB.getBook(id); HttpSession session = req.getSession(); List cart = (List) session.getAttribute("cart"); if (cart == null) { cart = new ArrayList(); session.setAttribute("cart", cart); } cart.add(book); 下面选项中,哪个是对上述代码功能的正确描述?()
举一反三
- 阅读下面代码:<br/>Book book = BookDB.getBook();<br/>HttpSession session = req.getSession();<br/>List cart = () session.getAttribute("cart");<br/>if (cart == null) {<br/>cart = new ArrayList();<br/>session.setAttribute("cart", cart);<br/>}<br/>cart.add();<br/>下面选项中,哪个是对上述代码功能的正确描述?() A: 实现不同用户的不同浏览器之间共享同一个购物车中的数据 B: 实现不同的应用程序之间共享同一个购物车中的数据 C: 实现放在不同web容器中的不同应用程序共享同一个购物车中的数据 D: 实现了每个不同的浏览器都有自己对应的一个购物车,来实现数据共享
- Given that a scoped attribute cart exist only in a user’s session, which two, taken independently, ensure the scoped attribute cart no longer exists?() A: ${cart = null } B: <c:remove var=”cart” /> C: <c:remove var=”${cart}” /> D: <c:remove var=”cart” scope=”session” /> E: <c:remove scope=”session”>cart</c:remove> F: <c:remove var=”${cart}” scope=”session” /> G: <c:remove scope=”session”>${cart}</c:remove>
- Given that a scoped attribute cart exists only in a user’s session, which two,taken independently,ensurethe scoped attribute cart no longer exists?() A: ${cart = null} B: <c:remove var="cart" /> C: <c:remove var="${cart}" /> D: <c:remove var="cart" scope="session" /> E: <c:remove scope="session">cart</c:remove>
- Given that a scoped attribute cart exists only in a user’s session, which two, taken independently, ensure the scoped attribute cart no longer exists?() A: ${cart = null} B: C: D: E: cart F: G: ${cart}
- Add to Cart