Hi there,

I have some questions concerning uploading of files. From
my previous HTML experience I know that for uploading of
files, one can (and should!) use the Oreilly Servlet package.


I get a nasty 'javax.servlet.ServletException: BeanUtils.populate
with root cause: java.lang.IllegalArgumentException: argument type 
mismatch when submitting a file.

Short explanation: I use a dedicated Action for uploading the file. The
idea is that when a user presses the submit button, this action is
triggered and uses the Oreilly Package for successfully receiving the file.

<Code Snipplet A: photo.jsp>

<html:form action="/uploadPhoto" method="POST" enctype="multipart/form-data">
<table border="0" width="100%">
    <tr>
        <td>
            <html:file property="file"/>
        </td>
    </tr>
    <tr>
        <td align="right">
            <html:submit>
                <bean:message key="button.upload"/>
            </html:submit>
        </td>
  </tr>
</table>
</html:form>

<Code Snipplet B: struts-config.xml>

    <action     path="/uploadPhoto"
   type="UploadPhotoAction"
   name="photoForm"
   scope="request"
   input="/photo.jsp">
  </action>


First question:  How is the property 'file' 
being transferred to the photoForm ? As a
string or file ? Is it being transferred to the 
form at all ? I assume it is, since the 
BeanProperties.populate.....

Second question: I can use a Servlet for
uploading the file instead of an action. The
problem then is how to formulize the 'action'
target of the form element. Should I use the
html:form action="http://localhost:8080/IZJNApp/servlet/uploadServlet";
or can I use html:form action="servlet/uploadServlet 
(which is much better since not depending on 
hardcoded localhost and port) Is this possible
and if yes, how ? Does anyone has a good
document about when to use servlets and when
to use actions ?

Third question: (Not very related). I have problems
downloading / viewing the struts config dtd found
at http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd
Where can I find this dtd ?

Last question: (rather simple) How can one
i18n the text on the 'browse' button (the submit
type) ? With other words, I want to replace the
'Browse' text on the submit button.

Perhaps that anyone has general solutions
for this problem, i.e. argument type 
mismatch ?

Thanks in advance,

Leonard

Reply via email to