String admissionNo = ""; //得到所有的cookies Cookie[] cookies = this.getRequest().getCookies(); Cookie cookie = null;//设置一个为null的cookie //循环cookies得到每个具体的cookie值 for (int j = 0; j < cookies.length; j++) { cookie = cookies[j]; if (cookie.getName().equals("hospital")) { admissionNo = cookie.getValue(); } }