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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -