1 4 package com.opensymphony.webwork.example.ajax.actions; 5 6 import com.opensymphony.webwork.interceptor.SessionAware; 7 import com.opensymphony.xwork.ActionSupport; 8 import org.apache.commons.logging.Log; 9 import org.apache.commons.logging.LogFactory; 10 11 import java.util.Map ; 12 13 18 public class SetActiveCategory extends ActionSupport implements SessionAware { 19 private Map session; 20 private Integer categoryId; 21 private static Log LOG = LogFactory.getLog(SetActiveCategory.class); 22 23 public void setSession(Map session) { 24 this.session = session; 25 } 26 27 public void setCategoryId(Integer categoryId) { 28 this.categoryId = categoryId; 29 } 30 31 public Integer getCategoryId() { 32 return categoryId; 33 } 34 35 public String execute() throws Exception { 36 LOG.debug("Setting the active category to " + categoryId); 37 if (categoryId != null) { 38 session.put(ActiveCategory.ACTIVE_CATEGORY_ID, categoryId); 39 } else { 40 session.remove(ActiveCategory.ACTIVE_CATEGORY_ID); 41 } 42 return SUCCESS; 43 } 44 } 45 | Popular Tags |