Hi all,

Here is the problem:

I have the following action mappings:
<action name="documentForm"
        path="/admin/documentEdit"
        scope="request"
        type="bg.crc.admintool.servlet.admin.DocumentEditAction"
        validate="false">
  <forward name="continue"
           path="/admin/index.jsp?content=document_edit.jsp"
           redirect="false"/>
</action>

<action input="/admin/documentEdit.do"
        name="documentForm"
        path="/admin/documentEditProcess"
        scope="request"
        type="bg.crc.admintool.servlet.admin.ProcessDocumentEditAction"
        validate="true">
  <forward name="continue"
           path="/admin/documentView.do"
           redirect="true"/>
</action>

The document_edit.jsp contains a multipart form for uploading a file.
There is also (in the document_edit.jsp file) a hidden field named "docId".

The logic flow is the following:
1. I request "/admin/documentEdit.do?docId=100"
2. "/admin/documentEdit" action forwards to document_edit.jsp
3. the form is displayed and the hidden field is set to 100 (I use
<html:hidden property="docId"/> tag)
4. I set the form fields deliberately so that when I submit it the form
validation should fail.
5. I submit the form (the action is "/admin/documentEditProcess")
6. The controller servlet calls validate(), the method fails and the
controller forwards to
   "/admin/documentEdit.do" (as specified by the input attribute of the
mapping).
7. The document_edit.jsp page is displayed again with the error message but
the hidden field
   is set to zero (zero because the form bean reset method sets its docId
field to 0).

Well, at this point I expect the hidden field to be 100, not 0.
The interesting thing is that when I remove the
enctype="multipart/form-data" attribute from the form
tag everything works just fine, i.e the hidden field is corectly set to 100.
This means (in my opinion)
that the action servlet cannot populate correctly a form bean when a
multipart form is submitted and
the validate method returns non empty ActionErrors object.

Is this a bug or am I overlooking something?

My version of struts is 1.1-rc1.

Thank you in advance.
Greetings,
Drago


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

Reply via email to