You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2010/08/25 10:23:19 UTC

[jira] Resolved: (WICKET-2864) FileUpload and Wizard

     [ https://issues.apache.org/jira/browse/WICKET-2864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2864.
-----------------------------------

      Assignee: Igor Vaynberg
    Resolution: Cannot Reproduce

i fixed a problem with wizard and fileuploads recently. please try with latest snapshot and if still doesnt work reopen and attach a proper quickstart.

> FileUpload and Wizard
> ---------------------
>
>                 Key: WICKET-2864
>                 URL: https://issues.apache.org/jira/browse/WICKET-2864
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.4.8
>         Environment: ubuntu10.4 / jdk1.6.0_20 / tomcat-6.0.20 / Eclipse 3.5.2
>            Reporter: Martin Hubert
>            Assignee: Igor Vaynberg
>
> FileUploadField is always null if not in last WizardStep. 
> public TestWizard() {
> ...
> 		model.add(new StepFu());
> 		model.add(new StepTxt());
> ...
> }
> works, but for 
> public TestWizard() {
> ...
> 		model.add(new StepTxt());
> 		model.add(new StepFu());
> ...
> }
> the FileUpload ist always null. 
> ===
> import java.io.Serializable;
> import org.apache.wicket.extensions.wizard.Wizard;
> import org.apache.wicket.extensions.wizard.WizardModel;
> import org.apache.wicket.extensions.wizard.WizardStep;
> import org.apache.wicket.markup.html.form.TextField;
> import org.apache.wicket.markup.html.form.upload.FileUpload;
> import org.apache.wicket.markup.html.form.upload.FileUploadField;
> import org.apache.wicket.model.CompoundPropertyModel;
> public class TestWizard extends Wizard {
> 	private static final long serialVersionUID = 1L;
> 	public TestWizard(String id) {
> 		super(id);
> 		TestBean bean = new TestBean();
> 		setDefaultModel(new CompoundPropertyModel<TestBean>(bean));
> 		WizardModel model = new WizardModel();
> 		model.add(new StepFu());
> 		model.add(new StepTxt());
> 		init(model);
> 		getForm().setMultiPart(true);
> 	}
> 	public class TestBean implements Serializable {
> 		private static final long serialVersionUID = 1L;
> 		private String _text1;
> 		private FileUpload _fu;
> 		public String getText1() {
> 			return _text1;
> 		}
> 		public void setText1(String text1) {
> 			_text1 = text1;
> 		}
> 		public FileUpload getFu() {
> 			return _fu;
> 		}
> 		public void setFu(FileUpload fu) {
> 			_fu = fu;
> 		}
> 	}
> 	
> 	private final class StepTxt extends WizardStep {
> 		private static final long serialVersionUID = 1L;
> 		public StepTxt() {
> 			add(new TextField<String>("text1"));
> 		}
> 	}
> 	
> 	private final class StepFu extends WizardStep {
> 		private static final long serialVersionUID = 1L;
> 		public StepFu() {
> 			add(new FileUploadField("fu"));
> 		}
> 	}
> 	
> 	@Override
> 	public void onFinish() {
> 		TestBean bean = (TestBean) getDefaultModelObject();
> 		System.out.println("*******************************************");
> 		System.out.println("text1: " + bean.getText1());
> 		System.out.println("fu:    " + bean.getFu());
> 		System.out.println("*******************************************");
> 		setResponsePage(getApplication().getHomePage());
> 	}
> }
> ===
> Tested with wicket-1.4.7 and wicket-1.4.8

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.