• 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
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Thymeleaf validations not working

 
Greenhorn
Posts: 8
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am new to Spring web and I am having difficulties with an assignment.  The Thymeleaf validations are not working at all (my goal is an error message to appear where there is a mistake and the page to keep the correctly filled fields) and the page does not redirect as it should. I will be very happy if you could direct me as I am stuck on this one for quite some time .

The controller:




Binding Model



Company-add Template



Navbar
 
Petra Petrova
Greenhorn
Posts: 8
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made some progress and found some mistakes.
However now, when I put all correct details and click on Add, I still get error message for descriptio
Untitled2.png
[Thumbnail for Untitled2.png]
 
Saloon Keeper
Posts: 24499
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note to Tim Moores: There's no JSF I can see here. It's all ThymeLeaf, which is, I understand, a Spring alternative to JSF.

It's not that JSF cannot play nicely with most other web frameworks, but the two systems do approach things differently. For one thing, you don't code your own servlets in JSF; the FacesServlet is the Master Controller for that MVC platform.
 
Marshal
Posts: 26909
82
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm no Spring expert, but should you be using the @Min annotation to control the length of a String? Elsewhere you use the @Size annotation, apparently successfully.
 
Sheriff
Posts: 22504
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul is right, @Min is only for numbers. Perhaps the invalid numeric string is seen as 0 which is clearly less than 10.
reply
    Bookmark Topic Watch Topic
  • New Topic