Accessing org.apache.struts.Globals.LOCALE_KEY in javascript func

Hi Experts,

I am wondering if there is a way to access org.apache.struts.Globals.LOCALE_KEY from javascript func.

I am working on web app(Struts) with English and Chinese version. There are simple javascript popup error messages and I want to change language depends on locale.

Are there better ways to deal with something like this?

thanks,
dkim18Asked:
Who is Participating?
 
CEHJCommented:
<script type="text/javascript">
  var locale=<%=org.apache.struts.Globals.LOCALE_KEY%>;
  alert('The locale is ' + locale);
</script>

Open in new window


would be a simple scriptlet way
0
 
CEHJCommented:
Write the locale value into the page from the server side so the script can access it. JavaScript runs on the client.
0
 
dkim18Author Commented:
how do I write local value from the sever side???
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.