How do I access messages and labels that are defined in resou
I have the following defined in servlet.xml
I have two property files. One for labels(myapp.properties) and one for error messages (myapp-messages.properties).
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
failedInSaveMessage=Failed while saving the customer record.
I know how to access the messages that are defined in these property files from jsp.
I want to access these messages from java file, so that I can prepare my errors obj after fetching
<c:set var="errMessage"><spring:message code='failedInSaveMessage'/></c:set>
data from DB. I am not using validator interface.
How do I access msg text that is defined in resource files using msg code in java files?
Basically I need something like "spring:message code='failedInSaveMessage'"