Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring with Hibernate User Messages in Spring Displaying Validation Messages

Anish Palan
Anish Palan
3,157 Points

Why do we append 'error' instead of 'error-message' classname?

When in the div element you give the condition and if that is satisfied we want to append a class which you give as 'error'. My question is why dont we give the 'error-message' class name because that is the name of the class which is displaying the error message. And where does the 'error' class comes into picture?

1 Answer

Chris Ramacciotti
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Chris Ramacciotti
Treehouse Guest Teacher

Hi Anish! I use the error class name for the enclosing div so that it aligns with CSS I've written to style the error messages. I don't like to use the same class names for nested elements, so this helps differentiate between the enclosing div and its message. So, really it's all for CSS. You can see those styles here:

https://github.com/treehouse/giflib-hibernate/blob/master/src/main/resources/static/app.css#L547