以下哪段代码能从请求对象中获取名为"ORA-UID"的Cookie的值? ( )
A: String value = request. getCookie("ORA-UID");
B: String value = request.getHeader("ORA-UID");
C: Cookie[] cookies = request.getCookies();String cName= null;String value = null;if( cookies !=null){for(int i = 0 ;i<;cookies.length; i++){ cName = cookie[i].getName(;if(cName!=null &&. cName.equalsIgnoreCase("ORA-UID")){value = cookies[i].getValue();}
D: Cookie[] cookies = request.getCookies();if(cookies. length>;0){String value = cookies[0].getValue();}
A: String value = request. getCookie("ORA-UID");
B: String value = request.getHeader("ORA-UID");
C: Cookie[] cookies = request.getCookies();String cName= null;String value = null;if( cookies !=null){for(int i = 0 ;i<;cookies.length; i++){ cName = cookie[i].getName(;if(cName!=null &&. cName.equalsIgnoreCase("ORA-UID")){value = cookies[i].getValue();}
D: Cookie[] cookies = request.getCookies();if(cookies. length>;0){String value = cookies[0].getValue();}
举一反三
- 下面哪段代码能从请求对象中获取名为"UID"的Cookie的值? A: String value=request.getCookie("UID"); B: String value=request.getHeader("UID"); C: Cookie[] cs=request.getCookies(); String value=null; String cName=null;<br> if(cs!=null){ for(int i=0;i D: Cookie[] cs=request.getCookies(); if(cs.length>0){ String value=cs[0].getValue();<br> }
- 读取客户端存储的Cookie,以下操作正确的是( )。 A: Cookie newCookie=new Cookie(String key,Object value); B: response.addCookie(newCookie); C: Cookie[] cookies=response.getCookies(); D: Cookie[] cookies=request.getCookies();
- 写入Cookie对象,通过响应将Cookie写入客户端以下正确的是( )。 A: Cookie newCookie=new Cookie(String key,Object value); B: response.addCookie(newCookie); C: Cookie[] cookies=request.getCookies(); D: request.addCookie(newCookie);
- 下列选项中,用于获取客户端发给服务端的所有cookie对象的方法是( ) A: List cookies = request.getCookies(); B: Cookie[] cookies = request.getCookies(); C: List cookies = response.getCookies(); D: Cookie[] cookies = response.getCookies();
- PHP用于存储cookie数据的超级全局变量是( A: $_COOKIES B: $_GETCOOKIES C: $_GETCOOKIE D: $_COOKIE