Imagine we have a 'Car' bean containing information about the color of a car, and we want to display the color name in that specific color along with an image of the car next to it. Currently, the bean handles the conversion of the color name to a corresponding CSS class, leaving the JSP simply assigning this value to a div element. While this method may seem convenient, it blurs the lines between the business logic and presentation layers.
What is considered the best approach for mapping String or Enum values to CSS classes? Where should this mapping be done? (Keep in mind that there are 1000 values which might change over time.)
Thank you.