Search code examples
javacssspringtwitter-bootstraphibernate-validator

How i put css on message of Hibernate validator anotation message of spring project


In my model class have the code using anottation of hibernate validator:

@Size(min = 2, message = "Mínimo 2 caracteres")
private String nome;
@Size(min = 5, message = "Mínimo 5 caracteres")
private String descricao;

In my jsp page the message below my input, but I wanted to put this message bootstrap class. how do I handle this message anottation in the css? thank you,


Solution

  • You can attach a CSS class to the Spring tag that is actually displaying a the error like this:

    <sf:errors path="nome" cssClass="errortext" />

    Then define .errortext in your CSS file and set your styling from there.