01: /*
02: * $Id: $
03: *
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21: package org.apache.struts2.portlet.example.fileupload;
22:
23: import java.io.File;
24:
25: import org.apache.struts2.dispatcher.DefaultActionSupport;
26:
27: /**
28: * File Upload example's action. <code>FileUploadAction</code>
29: *
30: */
31: public class FileUploadAction extends DefaultActionSupport {
32:
33: private static final long serialVersionUID = 5156288255337069381L;
34:
35: private String contentType;
36: private File upload;
37: private String fileName;
38: private String caption;
39:
40: // since we are using <s:file name="upload" .../> the file name will be
41: // obtained through getter/setter of <file-tag-name>FileName
42: public String getUploadFileName() {
43: return fileName;
44: }
45:
46: public void setUploadFileName(String fileName) {
47: this .fileName = fileName;
48: }
49:
50: // since we are using <s:file name="upload" ... /> the content type will be
51: // obtained through getter/setter of <file-tag-name>ContentType
52: public String getUploadContentType() {
53: return contentType;
54: }
55:
56: public void setUploadContentType(String contentType) {
57: this .contentType = contentType;
58: }
59:
60: // since we are using <s:file name="upload" ... /> the File itself will be
61: // obtained through getter/setter of <file-tag-name>
62: public File getUpload() {
63: return upload;
64: }
65:
66: public void setUpload(File upload) {
67: this .upload = upload;
68: }
69:
70: public String getCaption() {
71: return caption;
72: }
73:
74: public void setCaption(String caption) {
75: this .caption = caption;
76: }
77:
78: public String upload() throws Exception {
79: return SUCCESS;
80: }
81:
82: }
|