Javascript interact with Java

Asked

Viewed 329 times

2

It is possible get a javascript value and put inside a java variable.

EX:

var len = $(" #relacaoPax select[name=tipo] ").length;
        console.log( "len = " + len );
    });
<% int l = len;
   System.out.println( "//L = " + l );
%>
  • 1

    You need AJAX, which is already a saturated subject. Some references: http://answall.com/questions/15028/popup-com-ajax-e-jquery/15081#15081 and http://answall.com/questions/22446/chamar-m%C3%A9todo-java-no-javascript/22464#22464

  • Then not possible, would have to have a servletto treat that the request of ajax.

  • That’s right, Fabio. :-)

  • Hello.... da uma pesquisa no motor "Nashorn" eh uma forma de intreragir o JAVA com Javascript ... ou seu Javascript com o seu Unix .... muito legal.

2 answers

1

1

It is not possible to do what you want because all the JAVA code of your page is processed on the server and when you get to the browser there will only be HTML and JAVASCRIPT code to be interpreted.

  • Okay, thanks, I’ll try other ways.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.