Hi ,
I want to call one
servlet from another .I'm writing a simple web-application to accomplish the same.
My context root is
Test.
I have the following files
Test/test.html
<html>
<body>
<form action=SS method=post>
<input type=submit value=go>
</form>
</body>
</html>
Test/WEB-INF/classes/Test
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Test extends HttpServlet {
public void doPost(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException {
PrintWriter out = resp.getWriter();
out.println("I' m inside calling servlet");
// What should i specifiy in the path ???
getServletContext().getNamedDispatcher("Test2").include(req,resp);
}
}
Test/WEB-INF/classes/Test2
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Test2 extends HttpServlet {
public void doPost(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException {
PrintWriter out = resp.getWriter();
out.println(" I'm inside called servlet");
}
}
Thanks
Rajesh
[ February 11, 2006: Message edited by: Bear Bibeault ]