I got a Servlet A which has a HTTPClient configured in it - declared a GetMethod which calls Servlet B (basically passing the url to the constructor of Servlet B".
In Servlet B I am setting some session vars and when the Servlet A gets back the control after the "execute" method but the session vars set in Servlet B are returning as null.
Servlet A
doPost(req,res)
{
HTTPClient client = new HTTPClient();
GetMethod get = new GetMethod("/ServletB.do");
client.execute(get);
System.out.println("Value of a is :: " + session.getAttribute("a")) ; //gives a NULL
}
Servlet B
doPost(req,res)
{
HTTPSession session = req.getSession();
session.setAttibute("a",a);
session.setAttibute("b",b);
}
Can you please let me know what my options are here to get around this issue?