Programming Tutorials

Using Multiple Message Resource Bundles in Struts

By: Jagan in Struts Tutorials on 2007-09-22  

We will use a different message resource bundle to store information about images. 

a. Create a new file called ImageResources.properties under src/java/struts.example directory (You can do this within Eclipse). Move the following entries from MessageResources.properties to ImageResources.properties:
 

image.beerchug=images/beerchug.gif
image.beerchug.alttext=It's Beer time
image.save=images/save.gif
image.save.alttext=Save the Form
image.cancel=images/cancel.gif
image.cancel.alttext=Cancel Submission

b. In the struts-config.xml, declare the new ImageResources.properties file as a Resource Bundle as
follows:
<message-resources parameter="struts.example.ImageResources"
key="bundle.image" null="false"/>

c. For each of the image tag that corresponds to these images, change the tags in JSPs to use the
bundle="bundle.image"






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Struts )

Latest Articles (in Struts)