Hi i am newbie to j2ee application. Can you please advice whether i can write a java logic inside javascript and if yes how. I dont have liberty to make new class and redirect it there on click of button
+2
A:
If you want the logic to execute on the client side, then (aside from applets etc) the logic will have to be written in JavaScript. There are tools such as GWT which convert Java to JavaScript, which may help you.
Another alternative is to use AJAX - you don't redirect the whole page when you want to execute the logic, but your JavaScript calls back to the server (which then executes the logic in Java, in your case) and then potentially alters one piece of the UI based on the response.
Jon Skeet
2009-03-26 07:36:04
A:
i found the way
function myjavascriptfunc(){
<% // put java code %> }
harshit
2009-03-26 12:13:13