01: /*
02: * Copyright 2004, 2005, 2006 Odysseus Software GmbH
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package de.odysseus.calyxo.demo.struts;
17:
18: import javax.servlet.http.HttpServletRequest;
19: import javax.servlet.http.HttpServletResponse;
20:
21: import org.apache.struts.action.Action;
22: import org.apache.struts.action.ActionForm;
23: import org.apache.struts.action.ActionForward;
24: import org.apache.struts.action.ActionMapping;
25:
26: import de.odysseus.calyxo.forms.FormProperties;
27: import de.odysseus.calyxo.forms.FormsSupport;
28:
29: /**
30: * Commit form data and forward back to input
31: *
32: * @author Christoph Beck
33: */
34: public class FormAction extends Action {
35: /**
36: * Commit form and forward to input.
37: */
38: public ActionForward execute(ActionMapping mapping,
39: ActionForm form, HttpServletRequest request,
40: HttpServletResponse response) throws Exception {
41:
42: FormsSupport support = FormsSupport.getInstance(request);
43: FormProperties properties = support.getFormProperties(request,
44: mapping.getPath());
45: properties.commit();
46:
47: return new ActionForward(mapping.getInput());
48: }
49: }
|