I\'m using Infragistics IgniteUI igUpload on my webpage to upload files to our Apache Tomcat server, and while the files are uploaded, I can\'t get access to them in my servlet
If you are using Struts2, you will probably have this setting in web.xml
:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Since the url-pattern is /*
, it means that every request is intercepted by the StrutsPrepareAndExecuteFilter (usually called Filter Dispatcher, that was also the old filter name, in Struts versions before 2.1.8).
If you call an action, this is perfect. If you call a servlet, a web-service, or something else, this is problematic, because Struts Filter should run for actions only.
To exclude a particular url (or a particular pattern) from being intercepted by the filter, you need to use the constant struts.action.excludePattern
in struts.xml, as described in
Jersey with Struts2
How to use Servlet in Struts2
Official Apache Documentation: web.xml
Then put in struts.xml
<constant name="struts.action.excludePattern" value="/YourServlet"/>
And it should work.
At this point, I'm curious to know why are you using Struts2 without exploiting the great inbuilt File Upload functionality, that is explained in
and that can work with other upload-oriented frameworks with minor adjustments, like demonstrated in:
I don't know the plugin you're using, but in your case the first (and probably only) problem I see is the name of the parameter sent out:
uploadDoc_0__frm_if
should be unnumbered, and it'll still need a mixed CamelCase / Snake_case approach in your variable name.