Update of /cvsroot/struts/dialogs/src/net/jspcontrols/dialogs/samples/selectaction
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12963/src/net/jspcontrols/dialogs/samples/selectaction
Added Files:
SelectActionTest.java
Log Message:
--- NEW FILE: SelectActionTest.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 net.jspcontrols.dialogs.actions.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;
/**
* Example of DispathQueryAction usage
*/
public class SelectActionTest extends SelectAction {
// Define button -> method mapping
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("app-submit-button-add", "add");
map.put("app-submit-button-delete", "delete");
map.put("app-submit-button-login", "login");
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 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");
}
}
|