Hi!,
I tried your way to Internationalized the Javascript message.
it worked fine for the 'bean:message...' but my rest of the
Javascript is not working.
Actually I have placed rest on my javascript in a .js file as below
<script language=javascript src="/jsp/datevalidation.js"></script>
<script language=javascript src="/jsp/calendar.js"></script>
None of my function in those files get executed and at the sam time it
throws me an exception while loading the page.
I am using WebLogic 5 with sp8 and Struts.
Any help is appriciated.
Thanks
Anshuman Nanda
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 30, 2001 2:01 PM
To: [EMAIL PROTECTED]
Subject: Re: Internationalized JavaScript?...Solved!!
I do appreciate the suggestions presented to me. Let me share with you how
I solved the problem.
It was actually quite simple. I simply added the following line to my
resin.conf (I'm using resin, but the same type of solution should work for
anything) file:
<servlet-mapping url-pattern='*.js'
servlet-name='com.caucho.jsp.JspServlet'/>
That way I can still keep the ".js" extension, but it will be considered a
jsp file to the servlet container. I then placed the bean:message tags
wherever I needed internationalized text (example: confirm("<bean:message
key="title.logon"/>" )) and ... voila! It works! I think. I tested it
only a couple times and only in one instance, but I think it will work for
what I need it for.
-Dallas
Dallas_Brownin
[EMAIL PROTECTED] To:
[EMAIL PROTECTED]
cc:
03/30/01 10:58 Fax to:
AM Subject: Internationalized
JavaScript?...
Please respond
to struts-user
Let's say you have an alert box that has a message. You want that message
to be internationalized. Let's also assume that you want your JavaScript
source to not be in the jsp/html page, you would rather link to it (i.e.
<script src="[location of JavaScript source file]">).
How do you get the internationalized message to show up in the alert box?
The only two solutions I can think of are these:
Bear in mind, they are only workarounds.
1- pass the message as parameters when calling the function. example:
onClick="alert(<bean:message key="international.message"/>)"
2- simply give up on the second requirement and keep the code in the jsp
page.
Any suggestions?
-Dallas