You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by pa...@freenet.de on 2009/02/19 15:14:15 UTC

Problem with using tag for file upload

Hello at all,

im a web-developer and we're using struts 2 for the web frontend. 

I've developed an application with does file upload handling and did it as following:

<s:form action="EBookAction" theme="simple" enctype="multipart/form-data" method="post">
<div class="post">
    <div class="post_title">
        <h1 class="left"><s:text name="org.media.ebook.legend"/></h1>
        <div class="clearer">&nbsp;</div>
    </div>
    <div class="post_body">
        <div class="errors">
            <s:fielderror/>
            <s:actionerror/>
        </div>

        <dl class="dl">
            <dt>
                <s:text name="org.media.ebook.name"/>
            </dt>
            <dd>
                <s:textfield name="displayName" cssClass="textfield"/>
            </dd>
            <dt>
                <s:text name="org.media.ebook.file"/>
            </dt>
            <dd>
                <s:file name="upload"/>
            </dd>
            <dt>
                <s:text name="org.media.ebook.published"/>
            </dt>
            <dd>
                <s:checkbox name="published"/>
            </dd>
        </dl>
    </div>
    <div class="post_bottom"></div>
</div>

<div class="clearer">&nbsp;</div>

<div class="buttonline_right">
    <div class="pagenav">
        <s:url  action="EBookAction"
                method="addEdit"
                id="addEditEBook"/>

        <sx:submit  href="%{addEditEBook}"
                    targets="content"
                    key="saveButtonProperty"
                    cssClass="button"
                    executeScripts="true"/>

        <s:url  id="cancelAddEBook"
                action="EBookAction"
                method="showOverview"/>

        <sx:submit  id="ebookCancelButton"
                    href="%{cancelAddEBook}"
                    targets="content"
                    key="cancelButtonProperty"
                    cssClass="button"
                    executeScripts="true"/>
        <div class="clearer">&nbsp;</div>
    </div>
    <div class="pagenav_bottom"></div>
</div>
</s:form>

The bold parts are the relevant for my issue. When I click the button I get an error from firebug:

e is null
bindHandler()("error", Object, null)struts_dojo.js (Linie 13736)(?)()()struts_dojo.js (Linie 1676)handler()("error", Object, null)struts_dojo.js (Linie 13821)(?)()()struts_dojo.js (Linie 1403)
var _b90=dojo.string.isBlank(this.errorText)?e.message:this.errorText;
This is an error from dojo. In the dojo file I found:

... bindHandler:function(type,data,e) ...

The error occures within the body of this function. The request is not executed.

I searched through the internet,but i can't find any solutions for this problem...

I use Struts 2.1.6 with the dojo plugin ("struts2-dojo-plugin-2.1.6.jar").

There are other ways to realize a file upload, but it works also in this way. I had it working, but after a refactoring of my application it did no longer work and I don't know why... 

Please help!

Thanks in advance

Pascal 
Gratis: Jeden Monat 3 SMS versenden-
Mit freenetMail - Ihrer kostenlose E-Mail-Adresse
http://email.freenet.de/dienste/emailoffice/produktuebersicht/basic/sms/index.html?pid=6830