Hello,

I would like to upload a file using a tapestry form. I have followed the
example presented here: 
http://tapestry.apache.org/tapestry5/tapestry-upload/

HTML :
<t:form>
        <t:errors/>
        <input t:type="upload" t:id="file" validate="required"/>
        <br/>
        <input type="submit" value="Upload"/>
</t:form>


JAVA :
public class UploadExample
    {
        private UploadedFile _file;

        public UploadedFile getFile()
        {
            return _file;
        }

        public void setFile(UploadedFile file)
        {
            _file = file;
        }

        public void onSuccess()
        {
            File copied = new File("/my/file/location/" +
_file.getFileName());
            
            _file.write(copied);
        }
    }


But when I try to access the page, I get a java.lang.NullPointerException.
And I don’t understand which variable should be initialized.

I used FileUpload 1.2
org.apache.tapestry.ioc.internal.util.TapestryException 
location
classpath:… / UploadExample.html, line 13, column 65


        <body>
        <t:form>
        <t:errors/>
        <input t:type="upload" t:id="file" validate="required"/>
        <br/>
        <input type="submit" value="Upload"/>
        </t:form>
        </body>


java.lang.NullPointerException 
Stack trace
•       
org.apache.tapestry.upload.components.Upload.beginRender(Upload.java:146)
•       org.apache.tapestry.upload.components.Upload.beginRender(Upload.java)
•
org.apache.tapestry.internal.structure.ComponentPageElementImpl$10$1.run(ComponentPageElementImpl.java:345)
•
org.apache.tapestry.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:931)
•
org.apache.tapestry.internal.structure.ComponentPageElementImpl.access$100(ComponentPageElementImpl.java:69)
•       ……
Does someone knows how to solve this ?
Thank you very much,
Martin 

-- 
View this message in context: 
http://www.nabble.com/T5---Upload-File-Component-%3A-NullPointerException-tf4777695.html#a13667023
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to