Hello, > -----Ursprüngliche Nachricht----- > Von: Torsten Krah <krah...@gmail.com> > Gesendet: Donnerstag, 1. Juni 2023 11:18 > An: users@tomcat.apache.org > Betreff: Re: Re-Cannot upload an image file from a deployed JSP page in > Tomcat 10 > > Am Donnerstag, dem 01.06.2023 um 08:52 +0000 schrieb Lauri: > > > You mention a servlet part, but I do not use a servlet. > > > All the code is contained in the JSP page. > > You need to divide that code in a JSP and in your upload servlet as you need > to provide the @MultipartConfig on that servlet which handles your upload. > Without that you will get: > > Unable to process parts as no multi-part configuration has been provided > > as an exception when accessing the request.getParts() API. > > The whole thing is all written there btw: > > https://docs.oracle.com/javaee/6/tutorial/doc/glrbb.html > > I don't know - maybe Mark does - if you can annotate a JSP page, had never > seen it or read about that so my best guess is, you can't do that and you need > to use a servlet + jsp unless you want to overwrite the JspServlet from > Tomcat with a custom one which does have that annotation and handles the > Jsp stuff. > > kind regards > > Torsten >
In general it is good practice to separate logic and layout. JSP are usually for providing the view / layout. Logic / java code should be used in servlets and other java classes (e.g. models). So it is recommended anyway to move java code from JSP to java classes. See https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller Greetings, Thomas