Spring MVC - 10. Validation

Sdílet
Vložit
  • čas přidán 28. 11. 2022
  • Spring MVC - 10. Validation
    Linkedin: / teddy-smith-015ba61a3
    Website: www.teddysmith.io
    Github: github.com/teddysmithdev
  • Jak na to + styl

Komentáře • 26

  • @user-zz4uj1mr5f
    @user-zz4uj1mr5f Před rokem

    I did it. Ty(thank you)

  • @lunatichigh2896
    @lunatichigh2896 Před rokem

    Whati s the difference of objects Errors and BindingResult? They seem to serve the same purpose. I saw a code using Errors as a replacement for BindingResult

  • @ppti12hasnasalsabillaa.59
    @ppti12hasnasalsabillaa.59 Před 11 měsíci

    why is the old data won't be deleted when i update the data?

  • @arnaudpoutieu1331
    @arnaudpoutieu1331 Před 10 měsíci +1

    Thank you Teddy for this serie. I am having a "Whitelabel Error Page" while testing the case where my fields are empty, I expected messages to be displayed on added p tags for the clubs-edit fragment. Any idea?

    • @aymanfarik5625
      @aymanfarik5625 Před 10 měsíci

      The same, what was the problem for you ?

    • @jackfrost8969
      @jackfrost8969 Před 4 měsíci

      If you follow the tutorial carefully, you will not get any error.
      Try rewatching. I also used to have that error and it was mainly because of missing annotations.

  • @vaiterius
    @vaiterius Před rokem +1

    10:10 I'm a bit confused as to why you added model.addAttribute() on the /clubs/new post view but not on the /clubs/{clubId}/edit view in 5:24?

    • @mostviewedtoks
      @mostviewedtoks Před rokem +3

      The reason is because when a user input all the necessary fields I have one wrong instead of returning the empty page and form it returns all the values he inputted so he/she won't have to start afresh

    • @fragrant3021
      @fragrant3021 Před 10 měsíci +1

      I have the same confuse, And I did not add model though, it still work for me.

    • @im-fr0sty72
      @im-fr0sty72 Před 10 měsíci

      damn, was curious to know. Appreciate it man@@mostviewedtoks

  • @mostviewedtoks
    @mostviewedtoks Před rokem +1

    Please mine is working fine but returning a blank message instead of the errors help!

    • @arnaudpoutieu1331
      @arnaudpoutieu1331 Před 10 měsíci

      I have the Whitelabel Error Page that is sent by Spring instead of returning back to the edit page. Is it the same on you side?

    • @vitaliykozienko2922
      @vitaliykozienko2922 Před 10 měsíci

      i have the same problem, when i try to create new club with blank fields, but it works when i try to edit club

    • @vitaliykozienko2922
      @vitaliykozienko2922 Před 10 měsíci

      also i copied code from author's github

    • @connor7847
      @connor7847 Před 4 měsíci +1

      I had the messages for edit but not create that I fixed by changing my ClubDto id data type from long to Long

  • @santoshpoptani7756
    @santoshpoptani7756 Před rokem

    Exception :Failed to convert value of type 'null' to required type 'long' .Hey Teddy its giviveig this exception when i change saveClub functions parameter from Club to ClubDto. Here club-create is sending null value to id in ClubDto . how can i fix this please help

    • @TeddySmithDev
      @TeddySmithDev  Před rokem

      Difficult to fix without seeing code. Please post picture in discord and I will look at it.

    • @santoshpoptani7756
      @santoshpoptani7756 Před rokem +2

      @@TeddySmithDev Thanks For Quick Response i fixed it by just adding hidden id input field just like club-edit.html

    • @greendill7770
      @greendill7770 Před rokem

      @@santoshpoptani7756 you helped me a lot

    • @andtv1992
      @andtv1992 Před rokem

      @santoshpoptani7756 could share did you add the hidden input?

    • @andtv1992
      @andtv1992 Před rokem

      @@TeddySmithDev Could you share which Spring-Boot-Starter-Validation version did you use?

  • @tutruong6808
    @tutruong6808 Před rokem

    I tried the same as you but BindingResult.hasErrors always return false ... help me.

    • @TeddySmithDev
      @TeddySmithDev  Před rokem +1

      One of your forms is likely mismatched with the model. Check to make sure all the properties in the DTO are valid. You can also step thru with debugger and it will tell you where issue is.