As far as possible, all @Bean
of a Spring MVC project must be managed by its context definition classes. The labels, content headings, and tab title of the view pages, which the majority of developers take for granted, must not be hardcoded but declared also as Spring-managed components.
This recipe will manage lighter features of an application such as error names, labels, header names, and titles using the ApplicationContext
.
Let us add view labels and titles to the previous projects ch02-web-xml
and ch02-web-jc
, through the following steps:
- In
ch02-web-xml
, create amessages_en_US.properties
file in thesrc\main\resources\config
directory. - A configuration file is composed of a code and message pair. The key is called the lookup of the message and also called the code of the message. Open
messages_en_US.properties
and add the following label to be used later in our title bar:
title=Creating View Titles
- Add another message...