ajax中print和println,ajax - show servlet's response.getWriter().println() before servlet's ends - Stac...

first of all I want to say that I am new in html/jsp/java/servlets, etc... and thanks to this forum i managed to get my first webapp working. But now I am having a problem and i couldnt find a solution on the site.

The problem is that I call a servlet from a jsp, this servlet deploys different applications and I simply want to show the println that I call in the servlet before de servlet ends, right now, even If I have 10 println in different moments of the deploy process, the server only shows them when the servlets ends processing, which doesnt hace much sense for my app because i am trying to show the different steps of the deploy.

The servlet code is something like this:

public class Deploys extends HttpServlet {

String HOME = System.getenv("TRACE_HOME");

public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

final PrintWriter out = res.getWriter();

String broker = req.getParameter("Broker");

String eg = req.getParameter("Eg");

String servicio = req.getParameter("cboServicios");

String bar = req.getParameter("cboBarFiles");

// deploy

BrokerProxy b;

try {

out.println("connecting to server");

b = utils.connect("LOCALQM");

out.println("connect succesfull");

ExecutionGroupProxy e = b.getExecutionGroupByName(eg);

String path = HOME + "\\deploys\\files\\" + servicio + "\\";

DeployResult dr = e.deploy(path + bar,true, 60000);

out.println("Deployment completion code = "+dr.getCompletionCode());

} catch (ConfigManagerProxyLoggedException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (ConfigManagerProxyPropertyNotInitializedException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

}

}

}

and the server shows this all at the same time

connecting to server

connect succesfull

starting deploy

deploy completed

I read that the way to to this is using ajax an jquetr but I couldnt find an example of how to do it, so if any one can help will be very appreciated

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值