Externalizing text messages

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 ...

Get Spring: Developing Java Applications for the Enterprise 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.