1
2
3
4
5
6 package example.struts;
7
8 import org.apache.struts.action.ActionForm;
9 import org.apache.struts.action.ActionMapping;
10 import org.apache.struts.action.ActionErrors;
11 import org.apache.struts.action.ActionMessage;
12 import javax.servlet.http.HttpServletRequest;
13
14 /***
15 *
16 * @author Sean C. Sullivan
17 *
18 */
19 public class FileDeleteForm extends ActionForm
20 {
21 private String id;
22
23 public void setFileId(String value)
24 {
25 this.id = value;
26 }
27
28 public String getFileId()
29 {
30 return this.id;
31 }
32
33 public void reset(ActionMapping mapping, HttpServletRequest request)
34 {
35 this.id = null;
36 }
37
38 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
39 {
40 ActionErrors errors = new ActionErrors();
41
42 if (this.getFileId() == null)
43 {
44 errors.add("file", new ActionMessage("error.fileid.missing"));
45 }
46 return errors;
47 }
48
49 public String toString()
50 {
51 return "id=" + String.valueOf(this.getFileId());
52 }
53 }