How to save a servlet output from within a different servlet? -
i have servlet , servlet b, servlet b returns html.
does knows if possible make call within servlet servlet b , store html response in file?
thanks
to call servlet servlet b can using requestdispacher this:
servleta:
servletcontext sc = getservletcontext(); requestdispatcher rd = sc.getrequestdispatcher("/servletb"); rd.forward(req, resp);
then use same code redirect servleta store returned html in session can access servleta
servletb:
servletcontext sc = getservletcontext(); session.setattribute("bhtml",html) requestdispatcher rd = sc.getrequestdispatcher("/servleta"); rd.forward(req, resp);
and in servleta html session:
string html=request.getsession().getattribute("bhtml").tostring();
then can store in file this
Comments
Post a Comment