Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8545699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:51:11+00:00 2026-06-11T12:51:11+00:00

We have an application that using the basic JSP/servlet that all text currently in

  • 0

We have an application that using the basic JSP/servlet that all text currently in English is hard coded in the JSP pages. We are considering about internationalizations of our app, so we need some sort of ways to extract the text out into properties file.

Here is what I have done so far:
1) Create a file called XXXXX-messages_en.properties, add the key/value pair into the properties file, e.g. AAAAA = Hello World

2) Load JSTL relevant taglibs into the JSP page

<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

3) Replace the previous text with

<fmt:message key="AAAAA" bundle="${XXXXX}"/>

4) Add setBundle tag into the JSP page:

<fmt:setBundle basename="XXXXX-messages" var="XXXXX"/>

And restart the server, everything is correctly displayed.

However, my question regarding the usage of JSTL internationalization library is:

QUESTION 1) It appears that I have to add <fmt:setBundle> tag into each of singe JSP pages, which is a bit ugly and if something needs to change in the future (name change?) this will make life more difficult.

I have think about maybe I can create a separate page and put this <fmt:setBundle> in it, and then include this page using <jsp:include>. Or I can inject this via a servlet filter? I would say I am not quite happy with either options.

Is there any recommended way to do this?

QUESTION 2) How to specify a default language if there is no match properties file there? I have tested in my case, if I put <fmt:setLocale> into the JSP page with a French language, the page can still loaded correctly. Does that mean the English version is always the default or is it simply because my operating system/browser is English?

What will happen if a Chinese/Japanese user open my page and I have both English and French properties file there?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:51:12+00:00Added an answer on June 11, 2026 at 12:51 pm

    You can use a fallback locale to solve your second question:

    If no match is found, the formatting action looks for the so-called fallback-locale configuration setting. A configuration setting is a value set either by a context parameter in the application’s web.xml file or by a JSTL action or Java code in one of the JSP scopes. To set the fallback locale in the web.xml file, include these elements:

    <context-param>
      <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
      <param-value>en</param-value>
    </context-param>
    

    http://onjava.com/onjava/2002/09/11/jstl2.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a .net application that is currently using a encrypted text file
I have an MVC application that is using MEF for the controllers, all working
I have a basic MVC application that is using NHibernate for OR/M and data
I have an MVVM application that requires basic backward/forward navigation between screens. Currently, I
We have an application that logs using log4net. But we would like to delete
I have an application that is using both the carrierwave & tire gems. The
I have a web application that is using both jQuery 1.2.6 and YUI 2.6.0
I have a Silverlight application that is using a DataGrid. Inside of that DataGrid
I have a WCF application that is using NetTcpBinding . I want to invoke
I have a WPF application that is using a WindowsFormsHost control to host a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.