JAVA servlets - open message popup

前端 未结 4 477
名媛妹妹
名媛妹妹 2021-01-13 15:13

I want to user HttpServletResponse object to compose a response that will tell the browser client to open a popup with some message - how can i do that?

4条回答
  •  别那么骄傲
    2021-01-13 15:50

    Every Servlet response is basically an Http doc/snippet. So you could return a call to a javascript function that will be executed on the client side. The function can be passed in that Servlet response or it can be pre-included in the .js file.

    just an example:

    //servlet code
    PrintWriter out = response.getWriter();  
    response.setContentType("text/html");  
    out.println("");
    

提交回复
热议问题