• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CommonsMultipartFile file is killing me!

 
Ranch Hand
Posts: 150
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have spent days getting 400 and 404 errors thousands of times. It is driving me to maddness. I solved the 404 only to have a 400 Error:

400 Bad Request
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing).



**Keep in mind that this worked before I added the file upload and the file upload worked on it's own before I added it to my saveClient method**.

I really hope there is a solution to this. Any help is greatly appreciated.

Here is my code presently:

My post method:



My jsp Form:



My current method signature is:



I have tried:


And:


And:



And:



And Finally:




 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A 404 means that the wrong URL is targeted. This part:

action="<c:url value="/client/saveClient"/>"

looks suspicious. Does that produce the correct URL?
 
Ray Gilbert
Ranch Hand
Posts: 150
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:A 404 means that the wrong URL is targeted. This part:

action="<c:url value="/client/saveClient"/>"

looks suspicious. Does that produce the correct URL?



I have been dealing with both 404 and 400. I solved the 404 and when I did, rather than working, I now get:

(HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing).



I assumed that it was something in the method signature, hense the reason I made so many alterations of it. I'm coming from a springmvc course that built a project with one entity. That entity had three simple String fields. Not really practical, and not really useful for the real world.
 
Bartender
Posts: 2433
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ray,
I am not too familiar with that issue. Can you try a simple method like this ?

       
 
Ray Gilbert
Ranch Hand
Posts: 150
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Himai Minh wrote:Ray,
I am not too familiar with that issue. Can you try a simple method like this ?

       



Yes, I started with that. That was functional as I indicated in the first part of my post. It was when I added the upload component that it failed. As I said; The Client was working  before the upload component was added and the upload componenet was working stand alone..
 
Himai Minh
Bartender
Posts: 2433
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe, try MultiPartFile instead?
Here is a tutorial:
https://www.baeldung.com/spring-file-upload
 
Ray Gilbert
Ranch Hand
Posts: 150
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Himai Minh wrote:Maybe, try MultiPartFile instead?
Here is a tutorial:
https://www.baeldung.com/spring-file-upload



O.k. I solved it on my own, again. I took it back down to it's most basic implementation and built on it piece by piece until I got here:



I deeply appreciate all of the help and assistance that I gave me. I couldn't have done it without me.
 
Saloon Keeper
Posts: 15618
366
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm glad you managed to sort it out, but there is no need to be snarky. The members of this site are all volunteers, and spend their valuable free time to offer their insights. Sometimes those insights help, sometimes they don't, but if you're going you ask your questions here it would be nice if you'd be appreciative of that.
 
reply
    Bookmark Topic Watch Topic
  • New Topic