How to call function of JavaScript from servlet

后端 未结 3 1593
遇见更好的自我
遇见更好的自我 2021-01-13 03:14

I am new to web development. I have an external JavaScript file which has a function to show a prompt with error details. I need to pass the error message to the function. I

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-13 03:28

    It is not possible to call a java script function from a servlet. Rather, you can print javascript code using

    response.getOutputStream().println("[javascript code]");

    into the browser and then the javascript function will be executed in the browser.

提交回复
热议问题