Enrichman
Enrichman

Reputation: 11337

Is it possible to load different property files to use in the jsp with Spring messages?

I've different messages.properties files used for normal messages in my jsps, and also some other property files used in my java code.

One of this file is configured with some property to call a webservice, as the address, port and stuff like that. Let's call it service.properties.

One of my jsp has to call this service and I have to map the form with some information, like the action and the parameters. Right now I've written down these informations right in the jsp, but I find this not really nice, I would like to keep all the information coupled toghether inside the service.properties.

I'm looking for something to change the

<spring:message code="service.action.form"/>

to a customizable thing, to use not the messages but a specified property file

<spring:messageservice code="service.action.form" />

and move the information from the messages.properties to the service.properties

I don't know if this is possible, but I'm open to different options! Thanks.

Upvotes: 1

Views: 278

Answers (1)

Japan Trivedi
Japan Trivedi

Reputation: 4483

Yes you can do that.

Move your service related properties to file service.properties and then specify the path /WEB-INF/<properties folder path>/service in the basenames properties of bean ReloadableResourceBundleMessageSource declared in your configuration xml file. And then you can just access that message with <spring:message code='your.code'/>.

Hope this helps you.

Upvotes: 1

Related Questions