You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by #HO QUOC THUAN# <th...@pmail.ntu.edu.sg> on 2004/09/27 03:29:12 UTC
Passing javascript variable's value to servlet
How can a variable's value in javascript be passed to one variable specified in vm template?
Following is my try but it failed, $list value captured at the server side is a string of "javascript:geta();".
Do you have any suggestion?
<script ...>
var a;
function geta()
{
return a;
}
</script>
#set( $list = "javascript:geta();")
...
Thank you,
_thuan
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Passing javascript variable's value to servlet
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi thuan,
> How can a variable's value in javascript be passed to one variable specified in vm template?
You can't. Velocity and JavaScript work in different phases;
Velocity is used to create the HTML, whereas JavaScript is used to
execute it.
You'll have to figure a way to simulate the JavaScript's /result/ server side.
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai(shinobu.kawai@gmail.com)
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org