You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "zhouyanming (JIRA)" <ji...@apache.org> on 2014/08/19 03:36:18 UTC

[jira] [Commented] (WW-4388) Parameters are not injected when upload file

    [ https://issues.apache.org/jira/browse/WW-4388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14101679#comment-14101679 ] 

zhouyanming commented on WW-4388:
---------------------------------

cause by this commit

https://github.com/apache/struts/commit/8aa4fe860693d29e5ef94026bf2a7532ed74b9ea

> Parameters  are not injected when upload file
> ---------------------------------------------
>
>                 Key: WW-4388
>                 URL: https://issues.apache.org/jira/browse/WW-4388
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.3.18
>            Reporter: zhouyanming
>            Priority: Blocker
>
> {code:java}
> import java.io.File;
> import org.apache.struts2.ServletActionContext;
> import com.opensymphony.xwork2.ActionSupport;
> public class UploadAction extends ActionSupport {
> 	private static final long serialVersionUID = 625509291613761721L;
> 	private File[] file;
> 	private String[] fileFileName;
> 	private String folder;
> 	private boolean autorename;
> 	public boolean isAutorename() {
> 		return autorename;
> 	}
> 	public void setAutorename(boolean autorename) {
> 		this.autorename = autorename;
> 	}
> 	public void setFolder(String folder) {
> 		this.folder = folder;
> 	}
> 	public String getFolder() {
> 		return folder;
> 	}
> 	public void setFile(File[] file) {
> 		this.file = file;
> 	}
> 	public void setFileFileName(String[] fileFileName) {
> 		this.fileFileName = fileFileName;
> 	}
> 	@Override
> 	public String execute() {
> 		System.out.println(file); // not null
> 		System.out.println(fileFileName); // not null
> 		System.out.println(folder); // always null
> 		System.out.println(autorename); // always false
> 		// workaround for struts2 bug
> 		folder = ServletActionContext.getRequest().getParameter("folder");
> 		autorename = "true".equals(ServletActionContext.getRequest()
> 				.getParameter("autorename"));
> 		System.out.println(folder); // not null
> 		System.out.println(autorename); // true
> 		return SUCCESS;
> 	}
> }
> {code}
> It works fine with 2.3.16.



--
This message was sent by Atlassian JIRA
(v6.2#6252)