1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.struts.chain.commands.servlet;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.apache.struts.Globals;
21 import org.apache.struts.action.ActionForm;
22 import org.apache.struts.action.ActionMapping;
23 import org.apache.struts.chain.commands.AbstractPopulateActionForm;
24 import org.apache.struts.chain.contexts.ActionContext;
25 import org.apache.struts.chain.contexts.ServletActionContext;
26 import org.apache.struts.config.ActionConfig;
27 import org.apache.struts.util.RequestUtils;
28
29 /***
30 * <p>Populate the form bean (if any) for this request. Sets the multipart
31 * class from the action config in the request attributes.</p>
32 *
33 * @version $Rev: 421119 $ $Date: 2005-11-12 13:01:44 -0500 (Sat, 12 Nov 2005)
34 * $
35 */
36 public class PopulateActionForm extends AbstractPopulateActionForm {
37 private static final Log log = LogFactory.getLog(PopulateActionForm.class);
38
39
40 protected void populate(ActionContext context, ActionConfig actionConfig,
41 ActionForm actionForm)
42 throws Exception {
43 ServletActionContext saContext = (ServletActionContext) context;
44
45 RequestUtils.populate(actionForm, actionConfig.getPrefix(),
46 actionConfig.getSuffix(), saContext.getRequest());
47 }
48
49 protected void reset(ActionContext context, ActionConfig actionConfig,
50 ActionForm actionForm) {
51 ServletActionContext saContext = (ServletActionContext) context;
52
53 actionForm.reset((ActionMapping) actionConfig, saContext.getRequest());
54
55
56 if (actionConfig.getMultipartClass() != null) {
57 saContext.getRequestScope().put(Globals.MULTIPART_KEY,
58 actionConfig.getMultipartClass());
59 }
60 }
61 }