0
votes

I have an issue when uploading a file in struts 2. I used The encoding type of the jsp form as follows like multipart/form-data. When I upload a file and click submit button ,struts.xml returns action but does not reach the method in action class. This issue comes whether a file upload or not but when using encoding type as multipart/form-data in jsp form.

<form action="createTemp" id="registration" 
name="registration" validate="true" method="post" enctype="multipart/form-data">

Can you please pay your attention to this issue and provide a solution.

1
Can you provide more details? When you say struts.xml return action, does that mean you do not get any errors on the interface? What about errors in the logs? How do you know the action method was not run? - nmc

1 Answers

1
votes

All I get from what you say is that the required File variables are missing on the action side i.e. you are having an interceptor issue(not necessarily fileUpload interceptor).

Here is working example on how to upload a file in struts2.