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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:27:34+00:00 2026-05-11T02:27:34+00:00

Does Java and/or Spring have the concept of properties? I have bunch of domain

  • 0

Does Java and/or Spring have the concept of properties? I have bunch of domain models, each of which has several properties. Example:

public class Person {     private String name;     private Date dateOfBirth;     private float height;     private float weight;     // getters and setters not shown } 

When displaying a person, the property names are hardcoded in the JSP.

Name: ${person.name}<br> Date of birth: ${person.dateOfBirth}<br> Height: ${person.height}<br> Weight: ${person.weight}<br> 

Furthermore, there may be several different pages that display a person. Note that date of birth is a java.util.Date, so the JSP or controller will use java.text.SimpleDateFormat to format it. Height and weight are numbers, and they may have their own java.util.Format used for formatting.

What I’m looking for a property lookup mechanism. Each property (name, date of birth, height, etc) would have the display name, format, and description (used for help or tooltips). The properties’ attributes would be defined in a configuration file somewhere. When displaying a property, the display name and format would be looked-up via the property mechanism. This would also solve localization.

My question is if there’s already something like this implemented for Java.

  • 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. 2026-05-11T02:27:35+00:00Added an answer on May 11, 2026 at 2:27 am

    If I understand you correctly, you want to be able to put the format and description of some of these properties in an external file. You might want to take a look at Spring’s MessageSource (link to javadoc here), which somewhat wraps around and is analagous to the ResourceBundle class in the JDK.

    Using MessageSource‘s will allow you to place the format and any text in an external file (and have different properties files for different languages), but I believe you will still need to include in your JSP which properties to pass as arguments, for example:

    <spring:message code='user.dob' arguments='${user.dateOfBirth}'/> 

    where your messages.properties file contains:

    user.dob = Your date of birth is {0} 

    I’m not entirely sure how to specify the format within messages.properties, but I know that it is possible.

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

Sidebar

Related Questions

I have spring Java config object that loads my properties but does not override
Does java has library exception class which means actually not an error, but good
(Java Spring WebApp) I have: public class PersonValidator implements Validator { private PersonDAO d;
I want to have a payload-expression in spring integration that does this: #{T(java.util.Arrays).asList(#args[0],#args[1],#args[2])} I
Does it need manually close InputStream (bean.getContentAsStream()) in java after pass to Spring JDBC
Does Java have an equivalent to .NET resource (.resx) files for localization? In .NET,
Does java have an equivalent operator or language construct as the verbatim operator(@) in
Does Java have a built-in Antivirus? One of my friends told me there is
Does Java have (or is there a library available) that allows me to have
Question:- Does java client need to worry about multiple servers ? Meaning:- I have

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.