-1

what im trying to do is get a message when the user click the button a message appear on the console and on the tomcat logs

        <input type="button" value="Buscar" id="btnBuscar" name="btnBuscar" onclick="setTimeout(gotoPage(1),3000)" style="width: 100px"><br>
        <%
        System.out.println("page should refresh itself in 3 seconds" );
        %>
  • You do realize that the button is on the client, in the Web Browser, and Tomcat is on the server, right? Nothing will happen on the server unless you *communicate* with it, e.g. using Ajax. Or are you asking us to teach you Ajax? – Andreas Dec 08 '17 at 16:52
  • the thing is i dont have access to the server side so to find out whether they applying the changes i want a message display on the tomcat logs which is the only way i can see if the fix work or no and this project im working on doesnt use ajax just classic old jsp and java code. – Juan Saavedra Mora Dec 08 '17 at 17:01
  • You don't have access to the server side, but want tomcat logs, *which are on the server*, to write something?!?!? How did you envision changing the server code to write something if you don't have access to the server code? – Andreas Dec 08 '17 at 17:14
  • i can view the tomcat logs with notepadd++ using NppFTP – Juan Saavedra Mora Dec 08 '17 at 17:17
  • In what way is that relevant to changing the server code to write to the log? – Andreas Dec 08 '17 at 17:17
  • Is this perhaps an [XY problem](https://meta.stackexchange.com/q/66377/351454), and what you really need is the Web Browser console, so your client-side web browser javascript code can write log messages there that you can see, and that this doesn't have anything to do with the server? – Andreas Dec 08 '17 at 17:19
  • i have the code in a local environment which allow me to modify than send the modification via email as for the server i can view the tomcat logs with notepadd++ using NppFTP working for a big company and already develop code from 10 years ago a real hassle... – Juan Saavedra Mora Dec 08 '17 at 17:27
  • And that would work too ill see into it. – Juan Saavedra Mora Dec 08 '17 at 17:28

1 Answers1

0

The button will generate a JavaScript event. You must make that event to send a request to the server, and get the server processed by a Servlet or JSP.

This may help you:

Servlet returns "HTTP Status 404 The requested resource (/servlet) is not available"

How to call servlet when button click

Andres
  • 10,561
  • 4
  • 45
  • 63