From: <jm...@us...> - 2005-08-04 07:45:28
|
Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/selectaction In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20952/src/net/jspcontrols/dialogs/samples/selectaction Added Files: SelectActionSample.java Log Message: --- NEW FILE: SelectActionSample.java --- /* * Copyright 2004-2005 Michael Jouravlev * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.jspcontrols.dialogs.samples.selectaction; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletRequest; import java.util.Map; import java.util.HashMap; import java.io.IOException; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForward; import net.jspcontrols.dialogs.actions.SelectAction; /** * Example of DispathQueryAction usage */ public class SelectActionSample extends SelectAction { // Define button -> method mapping protected Map getKeyMethodMap() { Map map = new HashMap(); map.put(getInitKey() + "-ADD", "add"); map.put(getInitKey() + "-DELETE", "delete"); map.put(getInitKey() + "-LOGIN", "login"); map.put(getInitKey() + "-CANCEL", "cancel"); return map; } // Handler of Add button public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("addpage"); } // Handler of classic DispatchAction Add button public ActionForward Add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("addpage"); } // Handler of Delete button public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("deletepage"); } // Handler of Login button public ActionForward login(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("loginpage"); } // Handler of standard Cancel button public ActionForward cancelled(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("cancelpage"); } // Handler of unknown button public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { return mapping.findForward("unspecifiedpage"); } } |