So far, in all our View files we hardcoded text values for all the labels. As an example, take our addProduct.jsp
file—for the productId
input tag, we have a label tag with the hardcoded text value as Product id
:
<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 to have a single centralized control for all label messages. Moreover, it will help us to make our web pages ready for internationalization. We will talk more about internationalization in Chapter 6, Internalize Your Store with Interceptor, but, in order to perform internalization, we need to externalize the label messages first. So now you are going to see how to externalize locale-sensitive text messages from a web page to a property file.