spring - Accessing attribute with argument from file.properties in Java class -


let me explain want do:

i got properties containing property this:

message=hello {0}, welcome. 

i'd access property in java class using string , set parameter in class.

i've use fmt:message , fmt:param display kind of property in jsp want manipulate in java object (i know how inject property class).

any idea on how this?

you can use java.util.resourcebundle , java.text.messageformat examples

private string getstring( string bundle, string key, string defaultvalue, object... arguments ){     string result = resourcebundle.getbundle( bundle ).getstring( key );     if ( result == null ){         result = defaultvalue;     }     if ( arguments.length > 0 && result != null ){         result = messageformat.format( result, arguments );     }     return result;  } 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -