1 package net.sourceforge.formview.usecases.action; 2 3 import javax.servlet.http.HttpServletRequest ; 4 import javax.servlet.http.HttpServletResponse ; 5 6 import net.sourceforge.formview.usecases.form.ProjectWithSubForm; 7 import net.sourceforge.formview.util.WEBFormViewUtil; 8 import net.sourceforge.jsptabcontrol.util.JSPTabControlUtil; 9 10 import org.apache.struts.action.ActionForm; 11 import org.apache.struts.action.ActionForward; 12 import org.apache.struts.action.ActionMapping; 13 14 public class ProjectWithSubFormAction extends ProjectAction { 15 16 public ActionForward display(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, 17 HttpServletResponse response) throws Exception { 18 String formName = mapping.getPath(); 19 WEBFormViewUtil.saveFormView(request, getServlet().getServletContext(), formName, "PROJECT_TABPAGE"); 21 22 WEBFormViewUtil.saveFormView(request, getServlet().getServletContext(), formName, "DEVELOPERS_TABPAGE"); 24 return super.display(mapping, actionForm, request, response); 25 } 26 27 28 public ActionForward refreshState(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, 29 HttpServletResponse response) throws Exception { 30 ProjectWithSubForm form = (ProjectWithSubForm)actionForm; 31 String projectTabPageState = form.getProjectTabPageState(); 32 String developersTabPageState = form.getDevelopersTabPageState(); 33 34 String tabControlName = "FORMVIEW_WITH_JSPTABCONTROL"; 35 36 if (projectTabPageState != null && projectTabPageState.length() > 0) { 37 String subFormId = "PROJECT_TABPAGE"; 38 WEBFormViewUtil.saveState(request, getServlet().getServletContext(), projectTabPageState, subFormId); 41 42 43 JSPTabControlUtil.setTabPageState(getServlet().getServletContext(), request, tabControlName, subFormId, projectTabPageState); 45 } 46 47 if (developersTabPageState != null && developersTabPageState.length() > 0) { 48 String subFormId = "DEVELOPERS_TABPAGE"; 49 WEBFormViewUtil.saveState(request, getServlet().getServletContext(), developersTabPageState, subFormId); 52 53 JSPTabControlUtil.setTabPageState(getServlet().getServletContext(), request, tabControlName, subFormId, developersTabPageState); 55 } 56 57 58 return display(mapping, actionForm, request, response); 59 } 60 } 61 | Popular Tags |