g*****g 发帖数: 34805 | 1 I want to have a simple popup, but how can I get a spring message in
javascript so it supports I18N? |
A**o 发帖数: 1550 | 2 make the jsp to encode right first.
generate the message using key or some scriptlet features.
so are you using spring mvc?
【在 g*****g 的大作中提到】 : I want to have a simple popup, but how can I get a spring message in : javascript so it supports I18N?
|
g*****g 发帖数: 34805 | 3 Can you elaborate?
In javascript
alert(...)
Now how do you make the message pass to alert?
【在 A**o 的大作中提到】 : make the jsp to encode right first. : generate the message using key or some scriptlet features. : so are you using spring mvc?
|
A**o 发帖数: 1550 | 4 alert('');
【在 g*****g 的大作中提到】 : Can you elaborate? : : In javascript : alert(...) : Now how do you make the message pass to alert?
|
g*****g 发帖数: 34805 | 5 I must be too tired this afternoon and couldn't think. The way you mentioned
was what I first tried, but the js is an external file and it cannot be
resolved at client side.
The point is that tag must be resolved on server side, as long as it is in
jsp, it will be fine.
So I put it in a hidden input, get it in js function using getElementById,
and it's working great. |
A**o 发帖数: 1550 | 6 it happened that i just suggest some coworker to do the same
this afternoon. however, the coworker's refactoring proposal
was denied. so nothing would happen.
mentioned
【在 g*****g 的大作中提到】 : I must be too tired this afternoon and couldn't think. The way you mentioned : was what I first tried, but the js is an external file and it cannot be : resolved at client side. : The point is that tag must be resolved on server side, as long as it is in : jsp, it will be fine. : So I put it in a hidden input, get it in js function using getElementById, : and it's working great.
|
A**o 发帖数: 1550 | 7 another workaround i was thinking this afternoon was:
make js an extension that will pass over to your JSP parser in the web.xml.
it's hack, i must say.
mentioned
【在 g*****g 的大作中提到】 : I must be too tired this afternoon and couldn't think. The way you mentioned : was what I first tried, but the js is an external file and it cannot be : resolved at client side. : The point is that tag must be resolved on server side, as long as it is in : jsp, it will be fine. : So I put it in a hidden input, get it in js function using getElementById, : and it's working great.
|
m******t 发帖数: 2416 | 8
mentioned
Whatever happened to rendering a good old javascript var in jsp and reference it from the js? 8-)
var alertmsg='';
【在 g*****g 的大作中提到】 : I must be too tired this afternoon and couldn't think. The way you mentioned : was what I first tried, but the js is an external file and it cannot be : resolved at client side. : The point is that tag must be resolved on server side, as long as it is in : jsp, it will be fine. : So I put it in a hidden input, get it in js function using getElementById, : and it's working great.
|
g*****g 发帖数: 34805 | 9 I want to keep the js from the jsp, coz the js is a big chunk of codes
by itself. So either you pass the message to js as a variable, which is
undesired since I called it in multiple places. Or the hidden input might
be the best trick.
reference it from the js? 8-)
【在 m******t 的大作中提到】 : : mentioned : Whatever happened to rendering a good old javascript var in jsp and reference it from the js? 8-) : var alertmsg='';
|