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?

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

Open in new window

would be a simple scriptlet way
Write the locale value into the page from the server side so the script can access it. JavaScript runs on the client.
dkim18Author Commented:
how do I write local value from the sever side???
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.