struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Struts Two <>
Subject Re: Struts2 upload
Date Sun, 02 Nov 2008 18:13:16 GMT
I had a similar problem and it used to happen whenever the file uploaded had a size larget
than the one specified in struts configuration. Try files of small size first to see if you
face the same issue (though your problem may be totally different).
----- Original Message ----
From: Nick J <>
Sent: Saturday, November 1, 2008 5:54:57 PM
Subject: Struts2 upload

Hi, I am having some trouble with Uploads in Struts 2.
Here is the action:
<package name="uploads" extends="json-default" namespace="/_uploads">
<!-- ...other actions ...-->
        <action name="imageUpload" class="uploadManager" method="imageUpload">
            <interceptor-ref name="fileUpload"/>

Here is the HTML form:
<form name="myForm" action="/_uploads/imageUpload"
    <input type="file" name="imageUpload" value="Browse ..." />
    <input type="submit" />

Here's the appropriate part of the action class:

    public String imageUpload() {
        return ActionSupport.SUCCESS;
    public List<Image> getImageList() {
        return images;
    public void setImageUpload(File myImage) {
        uploadedImage = myImage;
    public void setImageUploadContentType(String contentType) {
        imageContentType = contentType;
    public void setImageUploadFileName(String filename) {
        imageFilename = filename;

I have debugger break-points in the  imageUpload method, and in the setter
The execution never reaches the setters, and when it breaks in the
imageUpload method,
and I inspect the values of uploadedImage, imageContentType and
imageFilename they are all null, so the interceptor has not called the the
setters like I was expecting it to. As far as I can tell, this agrees with
all the tutorials I've read, so I'm at a loss now.. If anyone has any ideas,
I'd be very greatful!


View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share
what you know at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message