如何在调用函数时使用javascript中的scriplet在控制台中打印值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20900931/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 05:08:28  来源:igfitidea点击:

how to print values in console using scriplet in javascript while a function is called

javajavascriptjspscriptlet

提问by hemalatha karunakaran

How to print values in console (like System.out.println()in java) using scripletin javascriptwhile a function is called ? if i used System.out.println("test")in scripletthe values is getting printed while a jspform is loading but i want it to print only when a java script is called.

如何在调用函数时使用in在控制台(如System.out.println()in java)中打印值?如果我在加载表单时使用的值正在打印,但我希望它仅在调用 java 脚本时打印。scripletjavascriptSystem.out.println("test")scripletjsp

采纳答案by Suresh Atta

 System.out.println ("test");

That is java and you cannot execute that on client side.

那是java,你不能在客户端执行它。

You might looking for

你可能正在寻找

console.log("");

And while page loading it's printing because the jsp you are submitting processing on server side and java code executes there.

在页面加载时它正在打印,因为您在服务器端提交处理的 jsp 和 java 代码在那里执行。

In short:

简而言之:

回答by Moritz Petersen

Use:

用:

console.log('Hello World!');