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.struts.forms.legacy;
17:
18: import javax.servlet.http.HttpServletRequest;
19:
20: import org.apache.struts.action.ActionErrors;
21: import org.apache.struts.action.ActionForm;
22: import org.apache.struts.action.ActionMapping;
23:
24: import de.odysseus.calyxo.struts.forms.FormsDelegate;
25:
26: /**
27: * This class can be used as a drop-in replacement to struts' standard
28: * action form class.
29: * However, all form bean properties have to be of type
30: * <code>java.lang.String</code>.
31: * <p/>
32: * If you migrate from an existing struts application, this class might
33: * be the first step. You do not need to touch your JSP pages!
34: * However, if you want to keep the validated (and converted) form data,
35: * and get your form bean properties updated with the formatted values, use
36: * {@link de.odysseus.calyxo.struts.forms.legacy.FlushableActionForm}
37: * instead.
38: *
39: * @author Christoph Beck
40: */
41: public class SimpleActionForm extends ActionForm {
42: private final FormsDelegate delegate = new FormsDelegate();
43: private final FormAccessor accessor = new FormAccessor(this );
44:
45: /**
46: * Constructor.
47: */
48: public SimpleActionForm() {
49: super ();
50: }
51:
52: /* (non-Javadoc)
53: * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
54: */
55: public ActionErrors validate(ActionMapping mapping,
56: HttpServletRequest request) {
57: return delegate.validate(mapping, request, accessor);
58: }
59: }
|