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).Code:<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basenames"> <list> <value>myapp</value> <value>myapp-messages</value> </list> </property> </bean>
Code:myapp-messages.properties: failedInSaveMessage=Failed while saving the customer record.
I know how to access the messages that are defined in these property files from jsp.
for eg:
I want to access these messages from java file, so that I can prepare my errors obj after fetchingCode:<c:set var="errMessage"><spring:message code='failedInSaveMessage'/></c:set> <c:out value="${errMessage}"/>
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'"


Reply With Quote