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 going to see only how to externalize the locale-sensitive text messages from our web page.