If you're trying to do this because you want to display a message box on the client's computer from a
servlet, as in your
previous topic, then this is not going to work.
You have to be aware that the servlet runs on the server, not on the client computer. If you use the scripting API to run JavaScript code from your servlet, then it's going to run on the server, and not the client. If your goal is to display a message box on the client's computer, then trying to run JavaScript code on the server doesn't make sense.