7

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.

1
  • 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. Commented Jan 3, 2014 at 10:08

2 Answers 2

11
 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.

Sign up to request clarification or add additional context in comments.

2 Comments

thnx for the quick response,but this can only be user with browser but i want to print console in my server log file
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
1

Use:

console.log('Hello World!');

1 Comment

This does not print anything in the console if you write it in the jsp. This can only work in JS.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.