日期:2014-05-16 浏览次数:20378 次
if (request.getParameter("theme") != null) {
??Cookie cookie2 = new Cookie("formThemes", request.getParameter(
????"theme").toString());
??cookie2.setPath("/");
??//? cookie2.setDomain(host);
??cookie2.setMaxAge(33333333);
??response.addCookie(cookie2);
??request.setAttribute("formThemes",request.getParameter(
??"theme").toString());
?}else{
??//初次进入去默认的皮肤或者是cookie中已经存在的皮肤
??Cookie[] cookies = request.getCookies();
??if(cookies != null && cookies.length > 0 ){
???for(int i = 0 ; i < cookies.length ; i ++){
????Cookie cookie = (Cookie)cookies[i];
????if("formThemes".equals(cookie.getName())){
?????request.setAttribute("formThemes",cookie.getValue());
????}
???}
??} else {
???//不存在cookie,则设置默认值national
???request.setAttribute("formThemes","national");
??}
??
?}