Question

I am using Direct Web Remoting on Struts framework to show some I18N values.

For Example,
>File name = Test.js

function test()
{
DWRutil.getMyAlert("i18n.test.javascript.alert",function(str){
alert(str);
});
}

In DWRUtil's getMyAlert method return I18N value from applicationresources.properties

Question:
Is there any option to load a I18N values from applicationresources.properties to Test.js directly?

Was it helpful?

Solution

Since javascript works in client browser, applicationresources.properties is in server.

If you are using struts you can use bean:message tag to retrieve the i18n string as following in javascript.

var criteriaRequire = "<bean:message key="error.0044" />";
alert(criteriaRequire);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top