Re: Calling java within javascript




misdst23 wrote:
Hi,

I know I can call a static java method within javascript by using the
<% ... %> tags. But how can pass a javascript variable ?

Since you are mentioning java, I'm assuming you are creating JSP's.

function thefunction()
{

var = javascriptvariable ;

'var' is a keyword in javascript. Proper usage will be like the
following:

var variable_name = value;


<% testClass.set(var) ; %> ;

}

To do what you want, you can do something like the following:

function myFunc()
{
<%
System.out.println("var variable_name = " + value);
%>
}

Your value will have to be surrounded by quotes depending on whether
it's a string value or not.

.



Relevant Pages

  • Calling java within javascript
    ... I know I can call a static java method within javascript by using the ... function thefunction() ... var = javascriptvariable; ...
    (comp.lang.javascript)
  • Re: "Professional Javascript" review
    ... a null value is an empty object pointer" ... In java ... might be better off abandoned for javascript programming. ... var a, b, c, d, ...
    (comp.lang.javascript)
  • Re: on page exit
    ... of which JavaScript is only one. ... used in HTML with intrinsic event handler attribute values, ... var clickedLink = null; ...
    (comp.lang.javascript)
  • Re: Highlighter
    ... JavaScript, but during this project, I have to admit, I am not the ... var where, ergebnis; ... Say you try to highlight 'color' and there is an element somewhere on the page that has a style attribute with a setting for the color or background-color property - I think you can see where this will go horribly wrong. ...
    (comp.lang.javascript)
  • dynamically building and evaluating expressions in javascript (functionally)
    ... I'm a relative newbie to javascript and functional programming, ... user of my webpage to be able to filter this list any way he wants. ... var mylist; //temp list which will contain my results ...
    (comp.lang.functional)