Hello Mark,
> -----Ursprüngliche Nachricht----- > Von: Mark Foley <mfo...@novatec-inc.com> > Gesendet: Montag, 13. November 2023 23:12 > An: users@tomcat.apache.org > Betreff: Re: AW: FileUpload class not working with Tomcat 10.1 > > On Mon Nov 13 02:18:49 2023 "Thomas Hoffmann (Speed4Trade GmbH)" > <thomas.hoffm...@speed4trade.com.INVALID> wrote: > > Hello, > > > > > -----Ursprüngliche Nachricht----- > > > Von: Mark Foley <mfo...@novatec-inc.com> > > > Gesendet: Sonntag, 12. November 2023 19:04 > > > An: users@tomcat.apache.org > > > Betreff: Re: FileUpload class not working with Tomcat 10.1 > > > > > > On Fri Nov 10 15:57:50 2023 Christopher Schultz > > > <ch...@christopherschultz.net> wrote: > > > > > > > > Mark, > > > > > > > > On 11/10/23 12:53, Mark Foley wrote: > > > > > On Fri, 10 Nov 2023 17:11:59 Mark Thomas <ma...@apache.org > wrote: > > > > >> > > > > >> On 10/11/2023 16:49, Mark Foley wrote: > > > > >>> I recently upgraded from Tomcat 10.0.17 to 10.1.13. ... > > > > >>> > > > > >>> [deleted] > > > > > > > I've put your suggested code in place. > > > > > > <%@ page import="jakarta.servlet.http.Part" %> > > > > > > I replaced your: > > > > > > throw new IllegalStateException("Expected multi-part"); > > > > > > with: > > > > > > out.println("Expected multi-part"); > > > > > > Just to get things compiling OK. I'll deal with errors later. With > > > that change, it compiled w/o problem. I then attempted an upload. The > line: > > > > > > if(null == contentType || > > > !contentType.startsWith("multipart/form-data;")) > > > { > > > > > > returned TRUE so it did detect a multipart upload. Yay! That was a > > > relief However > > > > > > Part fileUpload = request.getPart("param-name"); > > > > > > Gave me the error: > > > > > > java.lang.IllegalStateException: Unable to process parts as no > > > multi-part configuration has been provided > > > > > > So, what does it mean that "no multi-part configuration has been > provided"? > > > Is "param-name" something I'm supposed to fill in? I tried > > > substituting the <input type="file"> field name, "taxResults", but that > gave the same error. > > > > The form element must have the attribute enctype="multipart/form- > data". > > Furthermore, the servlet must be annotated by "@MultipartConfig" > > > > I think for jsp files, there is a similar setting in the web.xml. > > This link might help out: > > https://stackoverflow.com/questions/37965890/add-annotation-to-jsp > > Thanks for your reply Thomas. > > I've checked your suggested link and I have no idea where to put all that > <?xml> stuff. Furthermore, the poster of that issue didn't say he got it > working. > > A respnder to the post said, "Actually every jsp file will be converted to > servlet because tomcat can only address servlet and so every jsp file is > indirectly a servlet and has all the features of it". I think he is > suggesting that > the <?xml> code is superfluous, but not exlpicitly stated as such. > > I am getting a TRUE return for > > if(null == contentType || !contentType.startsWith("multipart/form-data;")) > > so I think it is recognizing it as "multipart/form-data;". > > Does anyone have an example of a JSP program with > jakarta.servlet.http.Part class? > > I'll search for examples as well, but I really have no idea how to proceed. > > --Mark F. > The servlet specification defines the special folder WEB-INF. Within this folder, there is the configuration file named web.xml. Within this xml-File, the application is configured including the servlets. JSP-Files are compiled to servlets, either on-the-fly or during compilation time. I would recommend to take a look at some sample applications to get familiar with some java web-applications and the web.xml file. It is not only about the jsp-file but also the combination with the application configuration within the web.xml Thus you will need both, jsp-file and a corresponding web.xml configuration. Greetings! Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org