Using Multiple Message Resource Bundles in Struts

By: Jagan Emailed: 1673 times Printed: 2154 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

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"


Struts Home | All Struts Tutorials | Latest Struts Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Jagan
Importing a Certificate for the CA example using keytool in Java
The if-then-else Statement in Java
WHERE Clauses in SQL
The TryCatchFinally Interface in JSP
assert() Function Example program in C
Guidelines for Struts Application Development
Using printf function in C
File Inclusion in C
Using Multiple Message Resource Bundles in Struts
While and For Loops in C
Arrays sample program in C
Controlling Page Navigation in JSF - Static and Dynamic Navigation
Using cout.fill() in C++
Types of Profiles in J2ME
DateField sample program in J2ME

More Tutorials in Struts
Configuring JDBC DataSources in Struts
Struts Classes
FAQ: Why was reload removed from Struts (since 1.1)?
FAQ: Why are my checkboxes not being set from ON to OFF?
Using JavaScript to submit a form in Struts
How to prepopulate a form in Struts
Simple example of using the requiredif Validator rule in Struts
Chaining actions in Struts
When is the best time to validate input in Struts
What is a Plug-in and how to use Java plug-ins with Struts?
7 Best Practices of Struts
Origin and Architecture of Struts
ActionErrors and ActionError in Struts
Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices
Handling multiple buttons in HTML Form in Struts

More Latest News
Most Viewed Articles (in Struts )
Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices
ForwardAction in Struts
What is Struts? Which Version of Struts to use?
Creating Struts Modules
Protecting JSPs from direct access in Struts
Handling Duplicate Form Submissions in Struts
Using JavaScript to submit a form in Struts
Configuring JDBC DataSources in Struts
Downloading and installing Struts
Struts 1 vs Struts 2
Introduction to Struts Architecture
Installing and configuring Tomcat and Struts
Using Multiple Message Resource Bundles in Struts
Writing the first Struts application
Handling multiple buttons in HTML Form in Struts
Most Emailed Articles (in Struts)
What is Struts? Which Version of Struts to use?
Is Struts the most popular web application framework for Java?
What is a Model View Controller (MVC) Model?
WebWork 2 is now Apache Struts 2
MVC Architecture (Model 2 Architecture)
Struts Classes
Creating Struts Modules
Handling multiple buttons in HTML Form in Struts
Handling Duplicate Form Submissions in Struts
Guidelines for Struts Application Development
Chaining actions in Struts
History of Struts
Configuring JDBC DataSources in Struts
Downloading and installing Struts
Editing struts-config.xml in a Struts Application