Externalizing text messages

So far, in all our view files, we hardcoded text values for all of the labels. For instance, take our addProduct.jsp file for the product ID input tag; we have a label tag with a hardcoded text value as ProductId, as follows:

<label class="control-label col-lg-2 col-lg-2" for="productId">Product Id</label>

Externalizing these texts from a view file into a properties file will help us have single, centralized control of all the label messages, and moreover, it will help us make our web pages ready for internationalization. We will see more about internationalization in Chapter 6, Intercept Your Store with Interceptor, but in order to do internationalization, we need to externalize the label messages first. So now, we are ...

Get Spring MVC Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.