1 7 package fr.improve.struts.taglib.layout.util; 8 9 import javax.servlet.http.HttpServletRequest ; 10 import javax.servlet.http.HttpServletResponse ; 11 12 import org.apache.commons.logging.Log; 13 import org.apache.commons.logging.LogFactory; 14 15 import fr.improve.struts.taglib.layout.tab.TabTag; 16 17 22 public class TabsUtil { 23 private static final Log LOG = LogFactory.getLog(TabsUtil.class); 24 25 31 public static void setCurrentTab(String in_tabsGroup, String in_selectedTabKey, HttpServletRequest in_request, HttpServletResponse in_response) { 32 if (in_tabsGroup==null || in_tabsGroup.length()==0) { 34 throw new IllegalArgumentException ("in_tabsGroups cannot be null or empty"); 35 } 36 if (in_selectedTabKey==null || in_selectedTabKey.length()==0) { 37 throw new IllegalArgumentException ("in_selectedtabKey cannot be null or empty"); 38 } 39 if (in_request==null) { 40 throw new IllegalArgumentException ("in_request cannot be null"); 41 } 42 43 if (LOG.isDebugEnabled()) { 44 LOG.debug("Selecting tab '" + in_selectedTabKey + "' for tabs '" + in_tabsGroup + "'"); 45 } 46 47 in_request.setAttribute(in_tabsGroup, in_selectedTabKey); 49 50 TabTag.setSelectedTabNameFromCookie(in_request, in_response, in_tabsGroup, in_selectedTabKey); 52 } 53 } 54 | Popular Tags |