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 5982077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:02:07+00:00 2026-05-22T22:02:07+00:00

What is the best possible way to create a jsp table(key,value) from a properties

  • 0

What is the best possible way to create a jsp table(key,value) from a properties file.

Right now I am doing this using scriptlets…..

    ResourceBundle statusCodes = ResourceBundle.getBundle("statuscode");    
Enumeration statusKeys = statusCodes.getKeys();


   <%
    while (statusKeys.hasMoreElements()) {
        String key = (String) statusKeys.nextElement();
        String value = statusCodes.getString(key);
%>
<tr>
    <td><%=key%></td>
    <td><%=value%></td>
</tr>

NOTE: Dont worry about syntax this is not complete code.

How can I do this using EL and jstl

  • 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-05-22T22:02:08+00:00Added an answer on May 22, 2026 at 10:02 pm

    You should be using java.util.Properties instead of java.util.ResourceBundle. The ResourceBundle serves an entirely different purpose and it should not be abused to have “an easy way” to load properties since it by default lookups resources from the classpath.

    Let a servlet load and prepare it for JSP.

    Properties properties = new Properties();
    properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("/filename.properties"));
    request.setAttribute("properties", properties);
    request.getRequestDispatcher("/WEB-INF/properties.jsp").forward(request, response);
    

    Because Properties implements java.util.Map, you can just use JSTL <c:forEach> to iterate over it. Every iteration gives a Map.Entry back which in turn has getKey() and getValue() methods.

    <table>
        <c:forEach items="${properties}" var="property">
            <tr>
                <td>${property.key}</td>
                <td>${property.value}</td>
            </tr>
        </c:forEach>
    </table>
    

    Finally invoke the servlet by its URL to get it to display.

    Please note that ResourceBundle doesn’t implement java.util.Map!

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

Sidebar

Related Questions

I'm trying to handle this possible exploit and wondering what is the best way
What will be the best possible way to create Custom Scrollbars using Javascript? Thanks
What's your opinion for the best possible way to build asp.net multilingual localized web
Possible Duplicate: What is the best way to do loops in JavaScript What’s the
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
I was wondering what is the best way (if at all possible) to determine
Is it possible, or does anyone know the best way to capture MSN chats?
So right now i need to create and implement an extension of the Python
What is the best way to create library agnostic wrapper for JS library selectors?
In Python, what is the best way to create a new list whose items

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.