How to print values in console (like System.out.println() in java) using scriplet in javascript while a function is called ? if i used System.out.println("test") in scriplet the values is getting printed while a jsp form is loading but i want it to print only when a java script is called.
-
you can use console.log(""); for client side logging. And if required you can log errors using the link above. Otherwise i am afraid simple logging from client side to server site cannot be achieved.Lakshmi– Lakshmi2014-01-03 10:08:19 +00:00Commented Jan 3, 2014 at 10:08
Add a comment
|
2 Answers
System.out.println ("test");
That is java and you cannot execute that on client side.
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.
2 Comments
hemalatha karunakaran
thnx for the quick response,but this can only be user with browser but i want to print console in my server log file
Suresh Atta
No ,you cannot.You should log the user activity on server side. Not with what he is doing on client side. Probably you need that link which Lakshmi added in comments
Use:
console.log('Hello World!');
1 Comment
clever_bassi
This does not print anything in the console if you write it in the jsp. This can only work in JS.