Reputation: 26647
We use a file called messages.properties with out JSTL format messaging which works well for serverside java and jsp. But for javascript we need the same messages but in a format that javascript can read. Should we just keep twofiles with one format for javascript e.g. JSON messages or similar? Can you propose anything or tell me how this is usually done to work with javascript? The variable from the Java code should be available to the javascript but that doesn't seem like a very neat solution.
Upvotes: 0
Views: 95
Reputation: 318518
Why not write some Java code that converts the Java format into e.g. JSON and then simply retrieve that from your JavaScript application.
Or even easier, use JSON for both - I'm sure there are tons of JSON parsers available for Java (and pretty much every other language).
Upvotes: 3