1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.tuigwaa.controller;
17
18 import javax.servlet.http.HttpServletRequest;
19
20 import org.apache.struts.action.ActionErrors;
21 import org.apache.struts.action.ActionMapping;
22 import org.apache.struts.action.ActionMessage;
23 import org.apache.struts.upload.MultipartRequestHandler;
24 import org.apache.struts.validator.DynaValidatorForm;
25 import org.seasar.tuigwaa.model.common.EntityUtils;
26 import org.seasar.tuigwaa.util.TgwContext;
27 import org.seasar.tuigwaa.util.TgwResource;
28 import org.seasar.tuigwaa.util.TgwUtils;
29
30 public class DynaConverterValidationForm extends DynaValidatorForm {
31
32 private static final long serialVersionUID = 1L;
33
34 public ActionErrors validate(ActionMapping mapping,
35 HttpServletRequest request) {
36
37 Boolean maxLengthExceeded = (Boolean) request
38 .getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED);
39 if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue())) {
40 String errorpage = TgwResource.getProperty("option.fileexceed.errorpage");
41 TgwContext.bindPageName(errorpage);
42 ActionErrors errors = new ActionErrors();
43 ActionMessage message = new ActionMessage(
44 "error.message.maxlengthexceed");
45 errors.add("file", message);
46 return errors;
47 }
48
49
50 String siteName = TgwContext.getSiteName();
51 String formName = mapping.getName();
52 TgwUtils.convert(siteName, formName, this);
53
54
55 String pageName = (String) EntityUtils.getProperty(this, "_pageName_");
56 TgwContext.bindPageName(pageName);
57
58 return super.validate(mapping, request);
59 }
60 }