I am trying to get the result from servlet (B) within servlet (A) and react to the result.
e.g.
in servlet B
response.getWriter().print("HELLO");
in servlet A
ServletContext context = this.getServletContext();
RequestDispatcher dispatcher = context.getRequestDispatcher("/B");
dispatcher.include(request, response);
// if the response from B is "HELLO", then do something
What would be the best practice for the solution? or should the way it response in servlet B would be changed to other method?